How could I make a loop to continuously loop through these products. Thanks in a
ID: 3699416 • Letter: H
Question
How could I make a loop to continuously loop through these products. Thanks in advance.
var cards =[
new Tindercardsjs.card(4, 'Lacoste', 'Casual mens shoes, €120', 'images/lacoste.jpg'),
new Tindercardsjs.card(3, 'Puma', 'Lightweight runners, €60', 'images/puma.jpg'),
new Tindercardsjs.card(2, 'Adidas', 'Running shoe, €90', 'images/runners.jpg'),
new Tindercardsjs.card(1, 'Converse', 'Casual mens shoes, €40.', 'images/converse.jpg'),
new Tindercardsjs.card(0, 'Nike', 'free runs, €55', 'images/nike.jpg'),
];
Explanation / Answer
Your loop is catching the process and properties of Array.prototype as well to the array's contents. Like JCOC611 supposed, it is frequently better to loop during arrays the "right" way, however if you don't wish for to do that, you can utilize the array's hasOwnProperty function to verify if a property is really in the array or if it is element of Array.prototype
i think it will help you thank you
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.