JS_IsArrayObject

There was a scripting error on this page. While it is being addressed by site editors, you can view partial content below.

{{SpiderMonkeySidebar("JSAPI")}}

Determine if a specified object is an Array.

Syntax

bool
JS_IsArrayObject(JSContext *cx, JS::HandleValue value, bool *isArray);

bool
JS_IsArrayObject(JSContext *cx, JS::HandleObject obj, bool *isArray);

// Obsolete since JSAPI 44

bool
JS_IsArrayObject(JSContext *cx, JS::HandleValue value);

bool
JS_IsArrayObject(JSContext *cx, JS::HandleObject obj);
Name Type Description
cx {{jsapixref("JSRuntime", "JSContext *")}} A context.
value {{jsapixref("JS::Value", "JS::HandleValue")}} The value to examine.
obj {{jsapixref("JSObject", "JS::HandleObject")}} The object to examine.
isArray bool Whether the value/object is an array.

Description

JS_IsArrayObject determines if a specified object, obj or value, is an Array object.

On success, returns true and sets isArray indicating whether obj is an Array object or a wrapper around one. Otherwise returns false on failure.

See Also

  • {{ LXRSearch("ident", "i", "JS_IsArrayObject") }}
  • {{bug(959787)}} - added value
  • {{bug(1179003)}} - added isArray

Document Tags and Contributors

Contributors to this page: Itms, arai, fscholz, Jorend, Dria, Nickolay, Tservo
Last updated by: Itms,