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

14 lines
230 B
JavaScript

var x = "outside";
function outer() {
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
return x;
};
return function () {
var x = "inside";
return a();
}();
}
outer();