The push() method adds one or more elements to the end of an array and returns the new length of the array.
The push method is very generic and we can use this method with call() or apply() on objects resembling arrays. The push method depends on the array length to determine the inserting of new elements. If the array length property cannot be converted to a number then it would start inserting the items from 0 index position. push() also returns the new length of an array.
Syntax of push() Method
arr.push(element1, …, elementN)
//Creating new array var names=['Jack','Mark']; var arrLength=names.push("Obama","Bill"); console.log(arrLength); //4 console.log(names);//['Jack','Mark','Obama','Bill']