title: How to update only the given index of 2d array in javascript?
body: <p>I created a 2d array using Array constructor and filling it with a array inside it.</p>
  <pre><code>const a = new Array(26).fill(new Array(2).fill(-1));
  </code></pre>
  <p>When i try to do this <code>a[0][0] = 0</code> the 0th index of all 26 arrays have changed. How do I prevent that?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const a = new Array(26).fill(new Array(2).fill(-1));
  a[0][0] = 0
  
  console.log(a)</code></pre>
  </div>
  </div>
  </p>