How to deal with very long arrays : <p>I have a <code>longArray</code> which contains other long <code>arrays</code> at the beginning of my code(think of it as a database). I'm afraid if it slows down the speed of my code. </p>

<p>If I still want both <strong>execution speed</strong> and the <code>longArray</code>, What do you recommend?</p>

<p>I thought if I could put my array into a function and access its data only when I need the array data it would be a solution, but it seems there is no way to do 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>function foo (){
var longArray = [1, 2, 3, 4, 5];
}

console.log(a)</code></pre>
</div>
</div>
</p>
