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

Test whether a given object is a Function.

Syntax

bool
JS_ObjectIsFunction(JSContext *cx, JSObject *obj);
Name Type Description
cx JSContext * A context.
obj JSObject * The object to test. This must not be NULL.

Description

JS_ObjectIsFunction tests whether obj is a function object (faster than comparing obj's class name to Function, but equivalent unless someone has overwritten the Function identifier with a different constructor and then created instances using that constructor that might be passed in as obj).

JS_ObjectIsFunction returns true if obj is a Function and false otherwise.

If JS_ObjectIsFunction returns true, JS_ValueToFunction will always return non-null. JS_ObjectIsFunction always succeeds. Note that the result may be false even for some callable objects, such as regular expression objects or proxy objects

See Also

Document Tags and Contributors

 Contributors to this page: kscarfone, arai, fscholz, BenjaminSmedberg, Jorend, MMondor, Bzbarsky
 Last updated by: kscarfone,