Javascript ES6 'let' and 'var' - unexpected behavior inside function with argument name matching redeclared variable
问题 Please note this is not duplicate of existing var vs let scope. I'm aware of the scope of var and let declarations and differences. But below scenario I could not justify with the understanding I had with let and var difference. In the below code, function foo accepts argument by name 'x' which has implicit let scope - as I cannot redeclare same variable name using let inside that function (uncommenting last line in function foo will throw JS error) "use strict"; function foo(x) { console.log