Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

JS_HasElement

This article needs a technical review. How you can help.

Determine whether a JavaScript array has an element in the specified index.

Syntax

bool
JS_HasElement(JSContext *cx, JS::HandleObject obj, uint32_t index, bool *foundp);
Name Type Description
cx JSContext * The context in which to perform the property lookup. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
obj JS::HandleObject The object to search for the element.
index uint32_t Index of the element to look up.
foundp bool * Out parameter. On success, it stores true to *foundp, false otherwise.

Description

JS_HasElement examines a specified JS object, obj, and its prototype chain, for an element or numeric property numbered index.

If the element exists, JS_HasElement sets *foundp to true. If not, it sets *foundp to false and returns true (to indicate no error occurred). If the search fails with an error or exception, JS_HasElement returns false, and the value left in *foundp is undefined.

See Also

Document Tags and Contributors

 Contributors to this page: kscarfone, arai
 Last updated by: kscarfone,