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.

JS_GetFunctionArity

Get the number of arguments a function expects.

Syntax

uint16_t
JS_GetFunctionArity(JSFunction *fun);
Name Type Description
fun JSFunction * A JavaScript function.

Description

JS_GetFunctionArity returns the number of formal parameters of a function, fun. This is the same as the function object's arity property, if that property has not been overwritten. Specifically, if fun is a native function, the result is the value that was passed to the nargs parameter of JS_DefineFunction. Otherwise fun is implemented in JavaScript, and the result is the number of identifiers in its formal parameter list (see ECMA 262-3 §13).

Note that it is not an error per se to call a JavaScript function with more or fewer actual arguments than its arity.

See Also

Document Tags and Contributors

 Contributors to this page: arai, fscholz, Jorend
 Last updated by: arai,