JavaScript Shopping Cart Tutorial - Part 3/5

preview_player
Показать описание


★☆★ Best Website Hosting:

★☆★UDEMY COURSES:

★☆★Best laptops for Coding:

★☆★Best JavaScript Books

My Social Media:

Рекомендации по теме
Комментарии
Автор

Guys this video was missing from the playlist, really sorry about that, and thanks for those of you who let me know <3

Telmosampaio
Автор

I've watched a lot of video tutorials but only this time I can understand clearly. Thanks Telmo!

tereshatampubolon
Автор

I have honestly been looking for this video for over a year now. You are a life saver

StayFlyJW
Автор

you know what ?! i dont know who u are, but i love u so much brooo :((( thank uuuu. i was trying add to cart 2 days, and u make my word happpier now . thank u

giorgiwereteli
Автор

FOR THOSE HAVING THE product: undefined ISSUE IN CONSOLE:

I literally spent the whole day solving the issue and read the code for a zillion times but to no avail.
What you have to do is, simple add "let " in the for loop you created.

INSTEAD OF:
for (i=0 ; i < carts.length ; i++) {
carts[i].addEventListener("click", function() {
cartNumbers(products[i]);
})
};

RATHER DO:
for (let i=0 ; i < carts.length ; i++) {
carts[i].addEventListener("click", function() {
cartNumbers(products[i]);
})
};

and the issue is solved 😭

sarymsikander
Автор

I've learned far more from your contents than my college lecturers. Thank you.

retardbuster
Автор

this is for those who got undefined while pass array as object on cartNumber(product) just use foreach instead of for loop due to some reason of index problem ok by hope you fix it if you have problem thanks by

buy_btn.forEach((btn, index) => {
btn.addEventListener("click", () => {
cartNumber(product[index]);
});
});

ameerhamza-pwvq
Автор

Love the accent, and the tutorial was super easy to follow and made learning js so much simpler when you explained it all so clearly and informativly. Love the work keep it up dude!

dasaltylmon
Автор

i am getting error at incart count code is right but its showing undefined

dilshadshaikh
Автор

It's better to make a product object inside setItems function every time we call it because, in your case, for every new product we add to the website we would have to ad a new object to the products array. Or we could make products array automatically create new product when the product is clicked. There are numerous ways that would make this solution programmatic/automated, as it actually needs to be in programming.

filipstanic
Автор

I'm following along great series thanks telmo!

joe-powell
Автор

Telmo Sampaio thank you for the video I absolutely love this video it's exactly what I was looking for as far as building a shopping cart for my project to show employers once this cov-19 ends. :D I did have a newbie question I'm fairly new to js compared to many others I only been working with the language for a few months and I noticed almost every tutorial or concept is something new... is that a normal situation throughout your learning or is it because I'm missing on basic concepts dealing with the language?

kidbrave_
Автор

Hi, I'm facing a problem. Where during my first click on the button, the console stated are null", and its added to the cart, yet as in the application part, the number added is falling 1 click behind. thanks

chinkenwee
Автор

You are just amazing. I clearly understand each and every step.thankyou so much.

hemalathahemalatha
Автор

When I add second product it is showing null in my inCart. Can anybody please help me?

maverick_deepak
Автор

I have a separate page for each product and it only show the first product when i console.log(product); how do i fix this

zeb
Автор

hi, your video is great. My object 'inCart' is an array not a number like you did. So could you pls guide me how to store the number of cart items in 'inCart' array?

CuongPham-uscl
Автор

At a moment I was like "Dudeee, is not working, there is a bug. What have you done, why is it working on your project but on mine is not, I wrote exactly the same thing" ...waits 2 minutes this isn't the final version of the function, yeah it makes sense"

larisacostrun
Автор

Can someone explain me this:

let cartItems = {
[product.tag]: product
}


what is that for and why he isn't just putting in the product itself into setItem as an value --> it is at 5:48

ducquang
Автор

I am getting an error saying that "My cart items null" in the console. It worked until 8:55. I followed as you did. Can I get a solution?

youssefamr
join shbcf.ru