JS GetArrayLength
From MDC
Retrieves the number of elements in an array object.
[edit] Syntax
JSBool JS_GetArrayLength(JSContext *cx, JSObject *obj, jsuint *lengthp);
| Name | Type | Description |
|---|---|---|
cx |
JSContext * |
The context in which to look up the array's length.
Requires request. (In a |
obj |
JSObject * |
The array object to examine. |
lengthp |
jsuint * |
Out parameter. On success, *lengthp receives the length of the array. |
[edit] Description
JS_GetArrayLength reports the number of elements in an array object, obj. If the number of elements can be determined, JS_GetArrayLength reports the number of elements in lengthp and returns JS_TRUE. Otherwise, it returns JS_FALSE, and the value left in *lengthp is undefined.