[solved] "Manipulate Arrays w/ Push". Is .push a Method?

The push() method adds one or more elements to the end of an array and returns the new length of the array.

var numbers = [1, 2, 3];
numbers.push(4);

console.log(numbers); // [1, 2, 3, 4]

numbers.push(5, 6, 7);

console.log(numbers); // [1, 2, 3, 4, 5, 6, 7]

Found this example here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push

1 Like