I think the solution could modifying the last line cartItems.innerHTML = cartHTML
to be increasingly repeatable with the loop based on the number of the products in the cartData (based on its length). Could any one help me with this?
for (var i = 0; i<cartData.length; i++) {
this["cartData"+i]=cartData[i]
let cartHTML = `
<tr class="cart-row">
<td><a href="#" type="button" class="cart-remove-button"><i class="far fa-times-circle"></i></a></td>
<td><img src="${cartData[i][2]}" alt=""></td>
<td>${cartData[i][0]}</td>
<td class="cart-price">DZD ${cartData[i][1]}</td>
<td><input class="cart-quantity-input" type="number" value="1"></td>
<td class="cart-sub-total">DZD ${cartData[i][1]}</td>
</tr>`;
//console.log(i)
**cartItems.innerHTML = cartHTML**
}
The line cartItems.innerHTML = cartHTML
have to be increasingly repeatable with the loop based on the number of the products in the cartData (based on its length).