Retrieve the number of elements in an array object.
bool JS_GetArrayLength(JSContext *cx, JS::Handle<JSObject*> obj, uint32_t *lengthp);
||The context in which to look up the array's length. Requires request. In a
||The object to examine.|
||Out parameter. On success,
JS_GetArrayLength gets the
.length property of
obj as though by calling
JS_GetProperty and converts it to a 32-bit unsigned integer. If
obj is an array (see
JS_IsArrayObject), this is guaranteed to succeed, because the
.length property of an array is always a number and can't be deleted or redefined.
JS_GetArrayLength stores the length in
*lengthp and returns
true. On failure, it reports an error and returns
false, and the value left in
*lengthp is undefined.