Determines whether an array element is defined in a given index.
arrayIsDefined(array, index)
→ returns boolean
someArray.isDefined(index)
CF 8+ To check an array element is define or not
someArray = [1,2,3,4,5];
writeOutput(arrayIsDefined(someArray, 3));
Expected Result: Yes
Lucee 4.5+ To check an array element is define or not
someArray = [1,2,3,4,5];
writeOutput(arrayIsDefined(someArray, 6));
Expected Result: false
CF 8+ To check an array element is define or not
FirstArray = [1,2,3];
secondArray = [11,12,13];
combineArray = arrayNew(2);
arrayAppend(combineArray, firstArray);
arrayAppend(combineArray, secondArray);
writeOutput(arrayIsDefined(combineArray, 3));
Expected Result: No
Lucee 4.5+ To check an array element is define or not
FirstArray = [1,2,3];
secondArray = [11,12,13];
combineArray = arrayNew(2);
arrayAppend(combineArray, firstArray);
arrayAppend(combineArray, secondArray);
writeOutput(arrayIsDefined(combineArray, 2));
Expected Result: true
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.