SuperSimpleDev / javascript-course

593 stars 477 forks source link

i spent over 3 days over 18hours to fix this but i can't pls help me to fix this on lesson 14 #84

Open nurhusenm opened 4 months ago

nurhusenm commented 4 months ago

here is what am facing it in the console tab the check out page is not working pls simon simplify the tech world Uncaught TypeError: Cannot read properties of undefined (reading 'id') at checkout.js:20:48 at Array.forEach () at checkout.js:7:6

MrItzreal commented 4 months ago

Hey, please upload your code. We can't troubleshoot the issue without seeing all the details. While you've shown us the console error, we still need to see your code itself. It's possible there's a typo, as I've followed all of his videos, including the latest one (number 16), and haven't encountered any problems. If you want check my git commits since I made them as Simon was doing them.

nurhusenm commented 4 months ago

Hey, please upload your code. We can't troubleshoot the issue without seeing all the details. While you've shown us the console error, we still need to see your code itself. It's possible there's a typo, as I've followed all of his videos, including the latest one (number 16), and haven't encountered any problems. If you want check my git commits since I made them as Simon was doing them.

which file should i uplaod as u know there is alot of files here is the checkout.html file code`<!DOCTYPE html>

Checkout
Checkout (3 items)
Review your order
Order Summary
Items (3):
$42.75
Shipping & handling:
$4.99
Total before tax:
$47.74
Estimated tax (10%):
$4.77
Order total:
$52.51
` and the checkout.js file ` Checkout
Checkout (3 items)
Review your order
Order Summary
Items (3):
$42.75
Shipping & handling:
$4.99
Total before tax:
$47.74
Estimated tax (10%):
$4.77
Order total:
$52.51
` cart.js `export let cart = JSON.parse(localStorage.getItem('cart')); if (!cart) { cart = [{ productId: 'e43638ce-6aa0-4b85-b27f-e1d07eb678c6', quantity: 2, }, { productId: '15b6fc6f-327a-4ec4-896f-486349e85a3d', quantity: 1 }]; } function saveToStorage() { localStorage.setItem('cart', JSON.stringify(cart)); } export function addToCart(productId) { let matchingItem; cart.forEach((cartItem) => { if (productId === cartItem.productId) { matchingItem = cartItem; } }); if (matchingItem) { matchingItem.quantity += 1; } else { cart.push({ productId: productId, quantity: 1 }); } saveToStorage(); } export function removeFromCart(productId) { const newCart = []; cart.forEach((cartItem) => { if (cartItem.productId !== productId) { newCart.push(cartItem); } }); cart = newCart; saveToStorage(); }`
nurhusenm commented 4 months ago

I sent 3 files of codes pls check the github account

On Wed, Feb 28, 2024, 6:18 PM Israel Santana @.***> wrote:

Hey, please upload your code. We can't troubleshoot the issue without seeing all the details. While you've shown us the console error, we still need to see your code itself. It's possible there's a typo, as I've followed all of his videos, including the latest one (number 16), and haven't encountered any problems.

— Reply to this email directly, view it on GitHub https://github.com/SuperSimpleDev/javascript-course/issues/84#issuecomment-1969209469, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGRAQKNYNIDXV3UBWCZXRTTYV5DFFAVCNFSM6AAAAABD6FWCA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRZGIYDSNBWHE . You are receiving this because you authored the thread.Message ID: @.***>

Monisha-devoper commented 3 months ago

here is what am facing it in the console tab the check out page is not working pls simon simplify the tech world Uncaught TypeError: Cannot read properties of undefined (reading 'id') at checkout.js:20:48 at Array.forEach () at checkout.js:7:6

hai unknown, am also faced the same problem last day now its resolved. i found that my browser is the problem some overloading issues.. things i followed first open your browser inside the vs code(extention browser) . if its works corectly then follow these steps: 1.open google chrome. 2.go to the setting area and clear the cache memory and history data .then try loading page again .. all the best.

nurhusenm commented 1 month ago

I stopped it since feb28 cause I decided to not follow yt tutorial,to escape from tutorial hell,and I focused on building simple projects by my self from scratch and I will build Amazon clone also inshallah from scratch by my self, it's better for u too to focus on simple projects to be confident on ur skills

Happy coding

On Fri, Jun 14, 2024, 4:30 PM hunganh26 @.***> wrote:

hello, have you resolved this problem yet. I've been stuck with the exact same problem for a bit. I also tried @Monisha-devoper https://github.com/Monisha-devoper suggestion but didnt seem to work.

— Reply to this email directly, view it on GitHub https://github.com/SuperSimpleDev/javascript-course/issues/84#issuecomment-2168056395, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGRAQKIML6FVVG2TKLUGDG3ZHLV6FAVCNFSM6AAAAABD6FWCA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRYGA2TMMZZGU . You are receiving this because you authored the thread.Message ID: @.***>