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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论