JavaScript array.push() Function

JavaScript Logo

array.push() – Adds one or more elements to the **end** of an array and returns the new length.

๐Ÿ‘‰ Syntax

newLength = array.push(element1, ...);

๐Ÿงช Example

const arr=[1]; arr.push(2,3); // arr=[1,2,3]

Comments