Description

Inserts an array element at the beginning of an array.

Returns

The updated array.

Category

Array functions

Function syntax

ArrayPrepend(array, value)

See also

ArrayAppend

Adding elements to an array in Basic array techniques in the Developing ColdFusion Applications

Parameters

Parameter

Description

array

Name of an array

value

Value to insert at beginning of array

Example

<cfscript>
    myArray = [3,2,1]; 
    arrayPrepend(myArray, 4);
    writeDump(myArray);
</cfscript>

Output

ArrayPrepend

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy