CountArraySize

Count an array size

javascript · Common Scripts

Details

IDCountArraySize
Languagejavascript
From Version5.0.0
TagsUtility

README

Counts an array’s size.

Script Data


Name Description
Script Type javascript
Tags Utility

Inputs


Argument Name Description
array The array to count the size of.
contextKey The context key to place the result in. The default is ArraySize.

Outputs


Path Description Type
ArraySize The array size. Unknown
var arr = args.array;
if (Array.isArray(arr)) {
    var key = 'ArraySize';
    if ((args.contextKey) && (args.contextKey.length > 0 )) {
        key = args.contextKey;
    }
    setContext(key,arr.length);
    return arr.length;
}
return 'Given input is not an array';