Signed-off-by: Michael Tang <michael.h.tang@gmail.com>
@@ -1,4 +1,15 @@
const notes = ['Note 1', 'Note 2', 'Note 3']
+// console.log(notes.pop())
+// notes.push('My new note')
+
+// console.log(notes.shift())
+// notes.unshift('My first note')
+// notes.splice(1, 1, 'This is the new second item')
+notes[2] = 'This is the new note 3'
console.log(notes.length)
-console.log(notes[notes.length - 2])
+console.log(notes)
@@ -1,6 +1,11 @@
const todo = ['Call with Jon', "Return Mom's trimmer", 'Get Insurance', 'Register for wcb', 'Wake up for christmas']
-console.log(`You have ${todo.length} todos.`)
+// Delete the 3rd item
+todo.splice(2, 1)
+// Add a new item onto the end
+todo.push('Email Paulo')
+// Remove the first item from the list
+todo.shift()
-console.log(todo[0])
-console.log(todo[todo.length - 1])
+console.log(`You have ${todo.length} todos.`)
+console.log(todo)