joi, 8 aprilie 2021

JavaScript/First_steps/Arrays

 https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Arrays

const list = document.querySelector('.output ul');

const totalBox = document.querySelector('.output p');

let total = 0;

list.innerHTML = '';

totalBox.textContent = '';

// number 1

                'Underpants:6.99'

                'Socks:5.99'

                'T-shirt:14.99'

                'Trousers:31.99'

                'Shoes:23.99';


for (let i = 0; i <= 0; i++) { // number 2

  // number 3


  // number 4


  // number 5

  let itemText = 0;


  const listItem = document.createElement('li');

  listItem.textContent = itemText;

  list.appendChild(listItem);

}


totalBox.textContent = 'Total: $' + total.toFixed(2);



Live output

  • 0

Total: $0.00


Live output

  • Underpants — $6.99
  • Socks — $5.99
  • T-shirt — $14.99
  • Trousers — $31.99
  • Shoes — $23.99

0 comentarii:

Trimiteți un comentariu

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More