push() Array Method | JavaScript Array Method
Somanath Goudar
Posted on March 21, 2021
You can Prefer to Read or you can Watch on YouTube:
=> The push() method adds a new element to an array (at the end)
=> The push() method returns the new array length
Example:
// Consider an array of Fruits
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi"); // Adds a new element ("Kiwi") to fruits
Example:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var x = fruits.push("Kiwi"); // the value of x is 5
💖 💪 🙅 🚩
Somanath Goudar
Posted on March 21, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
javascript Exploring Node.js: What Makes It a Powerful Choice for Server-Side Development
November 6, 2024