Inserts an array element at the beginning of an array and shifts the positions of the existing elements to make room.
arrayPrepend(array, value)
returns boolean
someArray.prepend(value)
Name | Type | Required | Default | Description |
---|---|---|---|---|
array | array | Yes | ||
value | any | Yes |
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);
CF11+ Lucee4.5+ Invoking the prepend function on an array is the same as running arrayPrepend.
doctorArray = ['Eccleston','Tennant','Smith','Capaldi'];
doctorArray.prepend('Hurt');
writeDump(doctorArray);