todo.js 509 B

1234567891011121314151617
  1. const todo = ['Call with Jon', "Return Mom's trimmer", 'Get Insurance', 'Register for wcb', 'Wake up for christmas']
  2. // Delete the 3rd item
  3. todo.splice(2, 1)
  4. // Add a new item onto the end
  5. todo.push('Email Paulo')
  6. // Remove the first item from the list
  7. todo.shift()
  8. console.log(`You have ${todo.length} todos.`)
  9. // todo.forEach(function (item, index) {
  10. // console.log(`${index + 1}. ${item}`)
  11. // })
  12. for (let count = 0; count < todo.length; count ++) {
  13. console.log(`${count + 1}. ${todo[count]}`)
  14. }