Push: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
Line 7: Line 7:
== Example (Basic) ==
== Example (Basic) ==


At position 2, remove 2 items:
Add an item to the end:
<pre>
<pre>
fruits = ["Banana", "Orange", "Apple", "Mango"]
fruits = ["Banana", "Orange", "Apple", "Mango"]

Revision as of 21:50, 4 February 2014

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)

Add an item to the end:

fruits = ["Banana", "Orange", "Apple", "Mango"]
count=Push(fruits,"Strawberry")

The result of fruits will be:

Banana,Orange,Apple,Mango,Strawberry

Example (JavaScript)

Add an item to the end.

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("strawberry")

The result of fruits will be:

Banana,Orange,Apple,Mango,Strawberry

Related Items

Array, Dim, LBound, Splice, ReDim