# const requires initialization

[JS](../../..) ⟩ [statement](../../../grammar/statement) ⟩ [declaration](../../../grammar/declare) ⟩ [const]() ⟩ requires initialization

{% hint style="danger" %}
a [](<> "mention") variable <mark style="color:red;">**must**</mark> be <mark style="color:yellow;">**initialized**</mark> at <mark style="color:yellow;">**declaration**</mark>.

👉 [require-initial](require-initial "mention")
{% endhint %}

{% tabs %}
{% tab title="💈範例" %}
* replit：[const requires initialization](https://replit.com/@pegasusroe/const-requires-initial-value#index.js)
* 👉 [syntax](../../../err/syntax "mention") ⟩ [const-no-initial](../../../err/syntax/const-no-initial "mention")

```javascript
const what;    // no initial value❗
//    ^^^^
// ⛔ SyntaxError: Missing initializer in const declaration
```
{% endtab %}

{% tab title="📗 參考" %}
* [ ] [ydkjs-scope-and-closures-v.2](../../../../master/ref/book/you-dont-know-js-series-v.2/ydkjs-scope-and-closures-v.2 "mention") ⟩ Ch. 5 ⟩ [Constants?](https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch5.md#constants)
{% endtab %}
{% endtabs %}
