ArrayPrepend
Append a value to the start an array
Method Signature
ArrayPrepend(array=[modifiableArray], value=[any])Arguments
Argument
Type
Required
Description
Default
array
modifiableArray
true
The array to prepend to
value
any
true
The value to prepend
Examples
Prepend a value to an array
Uses the arrayPrepend function to prepend a value to the beginning of an array and shifts the positions of the existing elements.
someArray = [
3,
2,
1
];
arrayPrepend( someArray, 4 );
writeDump( someArray );
Result: [4,3,2,1]
Prepend a value to an array using the Array member function
Invoking the prepend function on an array is the same as running arrayPrepend.
Result: ['Hurt','Eccleston','Tennant','Smith','Capaldi']
Additional Examples
Related
Last updated
Was this helpful?
