array push javascript
You may also have a look at the following articles to learn more –, JavaScript Training Program (39 Courses, 23 Projects). Array.prototype.push can work on an object just fine, as details. Javascript array push() method appends the given element(s) in the last of the array and returns the length of the new array. Instead, we store // Build an array of test data.
var arrLength = marks.push(["Riya",["Physics",93], ["Chemistry",85], ["Biology",91], ["Aeronatics",87]]); The Difference Between Array() and []¶ Using Array literal notation if you put a number in the square brackets it will return the number while using new Array() if you pass a number to the constructor, you will get an array of that length.. you call the Array() constructor with two or more arguments, the arguments will create the array elements.