Open hym1224 opened 6 years ago
from https://juejin.im/post/5a5cb80151882573385fb84d
惰性求值
let x = 99; function foo(p = x + 1) { console.log(p); } foo() // 100 x = 100; foo() // 101 // 上面代码中,参数p的默认值是x + 1。这时,每次调用函数foo,都会重新计算x + 1,而不是默认p等于 100。
from https://juejin.im/post/5a5cb80151882573385fb84d
惰性求值