mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-28 21:32: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
|
||||
```
|
||||
|
||||
另外,一个容易忽略的地方是,如果参数默认值是变量,那么参数就不是传值的,而是每次都重新计算默认值表达式的值。
|
||||
另外,一个容易忽略的地方是,如果参数默认值是变量,那么参数就不是传值的,而是每次都重新计算默认值表达式的值。也就是说,参数默认值是惰性求值的。
|
||||
|
||||
```javascript
|
||||
let x = 99;
|
||||
|
Loading…
x
Reference in New Issue
Block a user