Huáng Jùnliàng bffa415b83 Check shadow variable to identifier in default parameters (#10053)
When there is a variable declaration inside the function body, which shares its name to a referenced identifier in default parameter expression, the function body should be wrapped into iife, otherwise the binding in default parameter scope will be shadowed by function body.
2019-12-13 14:39:37 +01:00

7 lines
94 B
JavaScript

let x = "outside";
function outer(a = () => x) {
let x = "inside";
return a();
}
outer();