Updating Arrays

  • You can set individual items in arrays
  • You can remove items from the middle of the array
  • You can "push" items into the front or back of the array
let evenNumbers = [2, 3, 6, 8];
evenNumbers[1] = 4 // Oops;
evenNumbers.push(10); // [2, 4, 6, 8, 10]
evenNumbers.unshift(0); // [0, 2, 4, 6, 8, 10];
evenNumbers.splice(2, 1);
0
2
6
8
10

13 / 24