title: How are JavaScript arrays stored in memory
body: <p>So, I was thinking how arrays are stored in memory in JavaScript.</p>
  
  <p>I already read <a href="https://stackoverflow.com/questions/20321047/how-are-javascript-arrays-represented-in-physical-memory">How are JavaScript arrays represented in physical memory?</a> , but I couldn't find my answer.</p>
  
  <p>What I'm thinking is more about the memory location of the array units. In C for example, you need to define the size of the array when you define them. With this, C defines a whole block of memory, and it can look the exact location of each unit.</p>
  
  <p>For example:</p>
  
  <pre><code>int array[10]; // C knows the memory location of the 1st item of the array
  
  array[3] = 1   // C can do that, because it can calculate the location 
                 // of array[3] by doing &amp;array + 3 * (int size)
  </code></pre>
  
  <p>In JS, you can grow the size of an array after allocating memory to other stuff, which means JS doesn't work with the "block" type of array.</p>
  
  <p>But if arrays are not a single block of memory, how does JS calculate where each unit is? Do JS arrays follows a linked list type of structure?</p>