Skip to main content

Array Push

Module Info:​

moduleType: "internal",
moduleName: "push"

Description​

The push function inserts an item in an array or into a new one if no existing array is given.

Inputs​

NameTypeRequired
targetArrayArray<any> ✖ (Default: [])
newItemsobject ✖ (Default: {})
itemany ✖ (Default: undefined)

Do note that even though none of the inputs are required, giving no inputs to the function will result in the push function simply returning an empty array.

Outputs​

NameType
resultnumber

Examples​

Inputs Outputs
array result
[ "first", "second", "third" ] 3
[ "first", "second", "third", "fouth" ] 4
[ 4, "test", "foo" ] 3