Skip to content

JSArray.Concat

boxgaming edited this page Jul 25, 2026 · 3 revisions

Concatenates one or more variables and/or arrays into a new array.

Syntax

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

Parameters

  • The a parameter contains the native Javascript array on which the operation will be performed.
  • Valid item 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")

Dim otherColors(2) As String
otherColors(1) = "black"
otherColors(2) = "purple"

Dim allColors As Object
allColors = JSArray.Concat(colors, otherColors, "pink", "brown")

Print JSArray.Length(allColors)
Print JSArray.Item(allColors, 6)
Print JSArray.Item(allColors, 8)

Output

10
black
pink

See Also

JSArray.Create
JSArray.Item
JSArray.Length

Clone this wiki locally