Skip to content

JSArray.Create

boxgaming edited this page Jul 25, 2026 · 3 revisions

Creates a new array. If no parameters are specified a new, empty array will be created.

Syntax

a = JSArray.Create ([item1, item2, ... itemN])

Parameters

  • The optional item parameters can be used to prepopulate the array. Valid items parameters can be strings, numbers, objects, QBasic arrays or other native Javascript arrays.

Example

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

Dim colors As Object
colors = JSArray.Create("red", "green", "blue", "orange", "yellow", "white")

Print JSArray.Length(colors)
Print JSArray.Item(colors, 0)

Dim moreColors As Object
moreColors = JSArray.Create(colors, "black", "purple")

Print JSArray.Length(moreColors)
Print JSArray.At(moreColors, -1)

Output

6
8
purple

See Also

JSArray.At
JSArray.Concat
JSArray.Item
JSArray.Length

Clone this wiki locally