We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa9399e commit e02c14eCopy full SHA for e02c14e
docs/types/function.md
@@ -606,20 +606,20 @@ f(1, 1) // 5
606
607
上面代码中,函数`f`调用时传入的参数,在函数内部被修改成`3`和`2`。
608
609
-严格模式下,`arguments`对象是一个只读对象,修改它是无效的,但不会报错。
+严格模式下,`arguments`对象与函数参数不具有联动关系。也就是说,修改`arguments`对象不会影响到实际的函数参数。
610
611
```javascript
612
var f = function(a, b) {
613
'use strict'; // 开启严格模式
614
- arguments[0] = 3; // 无效
615
- arguments[1] = 2; // 无效
+ arguments[0] = 3;
+ arguments[1] = 2;
616
return a + b;
617
}
618
619
f(1, 1) // 2
620
```
621
622
-上面代码中,函数体内是严格模式,这时修改`arguments`对象就是无效的。
+上面代码中,函数体内是严格模式,这时修改`arguments`对象,不会影响到真实参数`a`和`b`。
623
624
通过`arguments`对象的`length`属性,可以判断函数调用时到底带几个参数。
625
0 commit comments