Skip to content

JSArray.Push

boxgaming edited this page Jul 25, 2026 · 2 revisions

Adds the specified elements to the end of an array.

Syntax

JSArray.Push a, item1 [, item2, ... itemN]

Parameters

  • The a parameter contains the native Javascript array on which the operation will be performed.
  • One or more item parameters can be passed to the method. Items will be added to the end of the array in the order they appear in the list.

Example

Import JSArray From "lib/lang/array.bas"

Dim numbers As Object
numbers = JSArray.Create("one", "two")

JSArray.Push numbers, "three"
Print JSArray.Length(numbers)
Print JSArray.Join(numbers)

JSArray.Push numbers, "four", "five", "six"
Print JSArray.Length(numbers)
Print JSArray.Join(numbers)

Output

3
one,two,three
6
one,two,three,four,five,six

See Also

JSArray.Add
JSArray.Create
JSArray.Join
JSArray.Length
Javascript - Array.push()

Clone this wiki locally