var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("strawberry")
No edit summary |
No edit summary |
||
Line 21: | Line 21: | ||
</tabber> | </tabber> | ||
== Output | == Output == | ||
The new value of fruits will be: | The new value of fruits will be: |
Push(array, item)
The Push() method adds an item to end of an array. This function changes the original array. It returns the number of items in the array after adding the new item.
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("strawberry")
fruits = ["Banana", "Orange", "Apple", "Mango"]
count=Push(fruits,"Strawberry")
The new value of fruits will be:
Banana,Orange,Apple,Mango,Strawberry