diff --git a/Chapter 3/Exercise 3.2 b/Chapter 3/Exercise 3.2 new file mode 100644 index 0000000..5d09742 --- /dev/null +++ b/Chapter 3/Exercise 3.2 @@ -0,0 +1,12 @@ +const myList = []; +myList.push("Milk", "Bread", "Apples"); +myList.splice(1, 1, "Bananas", "Eggs"); +const removeLast = myList.pop(); +console.log(removeLast); +myList.sort(); +console.log(myList.indexOf("Milk")); +myList.splice(1, 0, "Carrots", "Lettuce"); +const myList2 = ["Juice", "Pop"]; +const finalList = myList.concat(myList2, myList2); +console.log(finalList.lastIndexOf("Pop")); +console.log(finalList);