mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-29 05:42:20 +00:00
docs: fix function/参数默认值
This commit is contained in:
parent
eb2a62215a
commit
876a7b4bb1
@ -73,7 +73,7 @@ function foo(x, x, y = 1) {
|
|||||||
// SyntaxError: Duplicate parameter name not allowed in this context
|
// SyntaxError: Duplicate parameter name not allowed in this context
|
||||||
```
|
```
|
||||||
|
|
||||||
另外,一个容易忽略的地方是,如果参数默认值是变量,那么参数就不是传值的,而是每次都重新计算默认值表达式的值。
|
另外,一个容易忽略的地方是,如果参数默认值是变量,那么参数就不是传值的,而是每次都重新计算默认值表达式的值。也就是说,参数默认值是惰性求值的。
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
let x = 99;
|
let x = 99;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user