Skip to content

JSArray.Shift

boxgaming edited this page Jul 25, 2026 · 2 revisions

Removes the first element from an array and returns that element.

Syntax

result = JSArray.Shift ( a )

Parameters

  • The a parameter contains the native Javascript array on which the operation will be performed.

Example

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

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

Dim plants As Object
plants = JSArray.Create("broccoli", "cauliflower", "cabbage", "kale", "tomato")

Print JSArray.Shift(plants)
Print JSArray.Join(plants)
Print
Print JSArray.Shift(plants)
Print JSArray.Join(plants)

Output

broccoli
cauliflower,cabbage,kale,tomato

cauliflower
cabbage,kale,tomato

See Also

JSArray.Create
JSArray.Join
JSArray.Pop
JSArray.Unshift
JavaScript - Array.shift()

Clone this wiki locally