Skip to main content

ArrayPush

Takes an array and adds a new item to the end of it, returning a new array with the added element.

Reference

Parameters

array

The array to which the item will be appended.

Component data2-core-types@Getter

item

The element to append to the end of the array.

Component data2-core-primitives@String

Example

Input

[1, 2, 3, 4, 5]

Item: 6

Output:

[1, 2, 3, 4, 5, 6]

Note: The Item field is a string by default. If you need to push a different type, such as a number, make sure to change the Item field type accordingly. Otherwise, the value will be pushed as a string, resulting in a mixed-type array:

[1, 2, 3, 4, 5, "6"]