long JS_GetArrayLength()

Description

Given a pointer to an array object, this function gets the number of elements in the array.

Arguments

JSContext *cx, JSObject *obj

  • The cx argument is the opaque JSContext pointer that passes to the JavaScript function.
  • The obj argument is a pointer to an array object.

Returns

The number of elements in the array or -1 upon failure.