❗deplicate parameters
🚧 施工中
JS ⟩ objects ⟩ built-in ⟩ Function ⟩ parameter ⟩ duplicate parameters
in non-strict mode, JavaScript allows a function to have several parameters with the same name, where later parameters shadow earlier parameters.
⭐️ duplicate parameters not allowed in strict mode.
function g(x, y, x, y) {
// ^
// ⛔ SyntaxError:
// Duplicate parameter name not allowed in this context
// (note: this is a compile-time error)
'use strict'; // ⭐️ strict mode
return [x, y];
}
Last updated
Was this helpful?