pastebin

Paste Search Dynamic
Recent pastes
displayCart
  1. function displayCart() {
  2.     // Abbreviating other stuff to focus on the core topic...
  3.  
  4.     for (let i = 0; i < cart.length; i++) {
  5.         var cartItemHtml = [
  6.             '<div id="cart-item-' + i + '">',
  7.                 '<img class="w-10 h-10 object-cover rounded-md" src="' + cart[i].img + '" />',
  8.                 '<span class="ml-4 font-semibold text-sm">' + cart[i].name + '</span>',
  9.                 '<div>' + cart[i].price + '</div>',
  10.                 '<span class="px-3 py-1 rounded-md bg-red-300 text-white" onclick="removeFromCart(' + cart[i].id + ')">x</span>',
  11.             '</div>'
  12.         ].join("n");
  13.     }
  14. }
Parsed in 0.010 seconds