# 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

| Name  | Description                                  | Input Type  | Default | Options | Required |
| ----- | -------------------------------------------- | ----------- | ------- | ------- | -------- |
| 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

| Description                  | Output Type |
| ---------------------------- | ----------- |
| 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

1. Call the function "newArray" and set the variable name.\
   var: listOfFruits<br>

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-335de37f221c4c9194891f6ea7a69021dff1f57e%2Fpush-step-1.png?alt=media)
2. Call the function "push" and define the value.\
   value: mango

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-9209ed29f59ba5df3c534e36eaa05a5fa263d2ae%2Fpush-step-2.png?alt=media)
3. Call the function "push" and define the value.\
   value: jackfruits

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-75a9218365a7f0372806bdc694aa6c970b30d615%2Fpush-step-3.png?alt=media)
4. Add a console and call the function "getVar" to view the values in "listOfFruits" array.\
   value = getVar = listOfFruits

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-758f59a1514fed107da1f043c744172c12c956e8%2Fpush-step-4.png?alt=media)

### Result

"mango" and "jackfruits" are added to the array successfully.

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-2c80f22a836fb07f75b0b14da98e9405aca070c7%2Fpush-result-1.png?alt=media)

## Links
