Your Search Results


    Get the number of arguments a function expects.


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


    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: fscholz, Jorend, arai
    Last updated by: arai,
    Hide Sidebar