How to create static array in JavaScript
<p>I am trying to create a static array. But I found that it can increase the item in the array at run time. How I can achieve static array in JavaScript? Why array is mutable in JavaScript?</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>var a = [];
//var a = new Array(3);
for (var i = 0; i &lt; 5; i++) {
  //a.push(i);
  a[i] = i;
}

document.write(a);</code></pre>
</div>
</div>
</p>