This function adds one or more elements to the beginning of the original array and returns the length of the modified array.
arrayUnshift(array,object)
→ returns numeric
array.unshift(object)
Add a new element to an array.
arr=[1,2,3];
newArrLen=arrayUnshift(arr,0);
writeOutput(newArrLen);
Expected Result: 4
This is the same example as above, but using a member function on the array instead of a standalone function.
arr=[1,2,3];
newArrLen=arr.unshift(0);
writeOutput(newArrLen);
Expected Result: 4
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.