---
description: in "strict mode", duplicate parameters not allowed❗️
---

# duplicate parameter not allowed in strict mode❗️

[JS](../..) ⟩ [error](..) ⟩ [SyntaxError]() ⟩ 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>](duplicate-parameter)
{% 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](../../concept/env/js-engine/mode/sloppy-mode "mention")

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

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

* [compile](../compile "mention")

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

```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](../../concept/env/js-engine/mode/strict-mode/always "mention")
{% endtab %}
{% endtabs %}
