JavaScript 参考 JavaScript 错误参考 SyntaxError: redeclaration of formal parameter "x" 信息 SyntaxError: redeclaration of formal parameter "x" (Firefox) SyntaxError: Identifier "x" has already been declared (Chrome) SyntaxError: Cannot declare a let variable twice: 'x' (WebKit) ...
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 ...
The JavaScript exception "redeclaration of formal parameter" occurs when the same variable name occurs as a function parameter and is then redeclared using aletassignment in a function body again. Message SyntaxError: Let/Const redeclaration (Edge) SyntaxError: redeclaration of formal parameter "x" (F...
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 ...