How to Add Element at the End of an Array in JavaScript | push() Method

Опубликовано: 17 Июнь 2026
на канале: Anjali Tandel
5
0

The push() method in JavaScript is used to add one or more elements to the end of an array. It modifies the original array and returns the new length of the array.

Example :

const array = [1, 2, 3, 4, 5];
console.log(array);

array.push(6);
console.log(array);

array.push(7, 8, 9);
console.log(array);