How to use different object in javascript on click?
<p>Using Javascript, I have two arrays called "array1" and "array2".</p>

<p>I set currentArrray to be array1. Later when user clicks on some button, currentArray switches to Array2 and back to array1 if I click on it again.</p>

<p>This way, whenever there is any part of the code that needs to use an array, I just use something like in pseudocode:</p>

<pre><code>{currentArray}.getText;
{currentArray}.getText;
</code></pre>

<p>Is it possible to do something like this? If so, how?
I know you can use if statement, but because currentArray is used in different parts of code, it would be nice if I had a simple way like this where all I have to modify is currentArray variable so I dont have if statements scattered all over the place checking what currentArray is.</p>
