For the complete documentation index, see llms.txt. This page is also available as Markdown.

ArrayUnshift

This function adds one or more elements to the beginning of the original array and returns the length of the modified array.

Method Signature

ArrayUnshift(array=[modifiablearray], object=[any])

Arguments

Argument
Type
Required
Description
Default

array

modifiablearray

true

The array to add an item to

object

any

true

The value to add

Examples

Example with simple values

Add a new element to an array.

Run Example

arr = [ 
	1,
	2,
	3
];
newArrLen = arrayUnshift( arr, 0 );
writeOutput( newArrLen );

Result: 4

Using a member function

This is the same example as above, but using a member function on the array instead of a standalone function.

Run Example

Result: 4

Additional Examples

Run Example

Last updated

Was this helpful?