push
Description
Adds a new value to an array. An array has to be created using the newArray function first, before using the push function to add values to the array.
Input / Parameter
var
The name of the array to add a new value to.
String/Text
-
-
Yes
value
The value to be added to the array.
String/Text
-
-
Yes
Output
The updated array of values.
Array/List
Callback
N/A
Video
Coming Soon.
Example
The user wants to add new value into the array.
Step
Call the function "newArray" and set the variable name. var: listOfFruits
Call the function "push" and define the value. value: mango
Call the function "push" and define the value. value: jackfruits
Add a console and call the function "getVar" to view the values in "listOfFruits" array. value = getVar = listOfFruits
Result
"mango" and "jackfruits" are added to the array successfully.
Links
Last updated