Test whether a given object is a Function.


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


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