Push: Difference between revisions
Jump to navigation
Jump to search
Created page with "Push(''array'', ''item'') == Description == The Push() method adds an ''item'' to end of an ''array''. This function changes the original array. It returns the number of ite..." |
|||
Line 10: | Line 10: | ||
<pre> | <pre> | ||
fruits = ["Banana", "Orange", "Apple", "Mango"] | fruits = ["Banana", "Orange", "Apple", "Mango"] | ||
count= | count=Push(fruits,"Strawberry") | ||
</pre> | </pre> | ||
The result of fruits will be: | The result of fruits will be: |
Revision as of 16:04, 31 December 2013
Push(array, item)
Description
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.
Example (Basic)
At position 2, remove 2 items:
fruits = ["Banana", "Orange", "Apple", "Mango"] count=Push(fruits,"Strawberry")
The result of fruits will be:
Banana,Orange,Apple,Mango,Strawberry
Example (JavaScript)
At position 2, remove 2 items:
var fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.push("strawberry")
The result of fruits will be:
Banana,Orange,Apple,Mango,Strawberry