问题:Function对象的length是干嘛的?
------------ 函数期望的参数个数。
举例:
function test1(num){
//...
}
function test2(){
//...
}
console.log(test1.length); //1
console.log(test2.length); //0
本文详细解释了JavaScript中Function对象的length属性的作用,即表示函数期望的参数个数,并通过两个示例函数展示了如何获取这一信息。
问题:Function对象的length是干嘛的?
------------ 函数期望的参数个数。
举例:
function test1(num){
//...
}
function test2(){
//...
}
console.log(test1.length); //1
console.log(test2.length); //0
2570
860
1116

被折叠的 条评论
为什么被折叠?