Redeclaring the same variable within the same function or block scope using let is not allowed in JavaScript. Examples In this case, the variable "arg" redeclares the argument. function f(arg) { let arg = "foo";
SyntaxError: redeclaration of formal parameter "x" (Firefox) SyntaxError: Identifier "x" has already been declared (Chrome) SyntaxError: Cannot declare a let variable twice: 'x' (WebKit) 错误类型SyntaxError哪里出错了?某个变量名称已经作为函数参数出现了,但是又使用了 let 在函数体里重声明了。在...
Redeclaring the same variable within the same function or block scope using let is not allowed in JavaScript. Examples In this case, the variable "arg" redeclares the argument. function f(arg) { let arg = "foo"; } // SyntaxError: redeclaration of formal parameter "arg" If you want ...