# fill 2D array

{% tabs %}
{% tab title="JS" %}
```javascript
// matrix (2D array) filled with 0
Array(3)                          // [ , , ]
  .fill()      
  .map( _ => Array(3).fill(0) );
```
{% endtab %}

{% tab title="📗 參考 " %}
* [Create 2d array in javascript filled with 0](https://pretagteam.com/question/create-2d-array-in-javascript-filled-with-0)
{% endtab %}

{% tab title="💾 程式" %}
* replit - [SpiralMatrix 1.2](https://replit.com/@pegasusroe/SpiralMatrix-12#main.js)
{% endtab %}
{% endtabs %}
