Inserts a value at the specified position in the array. If the element is inserted before the end of the array, ColdFusion shifts the positions of all elements with a higher index to make room.
arrayInsertAt(array, position, value)
→ returns boolean
someArray.insertAt(position, value)
Inserts the number 4 at position 2
someArray = [1,2,3];
arrayInsertAt(someArray, 2, 4);
writeOutput(serializeJSON(someArray));
Expected Result: [1,4,2,3]
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.