ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

js参数默认值对函数length 和arguments影响

2026/9/21 6:36:34 拓冰建站 浏览量
js参数默认值对函数length 和arguments影响
function Foo(a,b){  console.log(a==arguments[0],b==arguments[1]);console.log(a,b);a='44';b='555';console.log(a==arguments[0],b==arguments[1]); //若Foo(a,b=3)设置默认值(相当于'use strice' 此时不相等 Foo.length:1 
}
Foo(10,1)
console.log(Foo.length) //1