> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/err/syntax/duplicate-parameter.md).

# duplicate parameter not allowed in strict mode❗️

in "strict mode", duplicate parameters not allowed❗️

[JS](/web/js.md) ⟩ [error](/web/js/err.md) ⟩ [SyntaxError](/web/js/err/syntax.md) ⟩ duplicate parameter name

{% hint style="danger" %}
⛔ <mark style="color:red;">**SyntaxError**</mark>: [<mark style="color:yellow;">**Duplicate parameter name not allowed in this context**</mark>](/web/js/err/syntax/duplicate-parameter.md)
{% endhint %}

{% tabs %}
{% tab title="💈範例" %}

* replit：[early errors](https://replit.com/@pegasusroe/early-errors-in-JS#index.js)

{% hint style="success" %}
no errors in [sloppy mode](/web/js/concept/env/js-engine/mode/sloppy-mode.md)

```javascript
console.log("Howdy");        // Howdy
sayHi("Hello", "Hi");        // Hi

function sayHi(x, x) {       // duplicate parameters
    console.log(x);
}
```

{% endhint %}

* [compile-time error](/web/js/err/compile.md)

{% hint style="danger" %}
⭐️ [deplicate parameters](/web/js/val/func/param/duplicate.md) <mark style="color:red;">**not allowed**</mark> in [strict mode](/web/js/concept/env/js-engine/mode/strict-mode.md).

```javascript
console.log("Howdy");        // ⭐️ never runs❗

// ⛔ SyntaxError: 
//    Duplicate parameter name not allowed in this context
//                ↓
function sayHi(x, x) {       // ⭐️ compile-time error
    "use strict";            // ⭐️ strict mode
    console.log(x);
}
```

{% endhint %}
{% endtab %}

{% tab title="👥 相關" %}

* [always use strict mode](/web/js/concept/env/js-engine/mode/strict-mode/always.md)
  {% endtab %}
  {% endtabs %}
