How to search a specific array determined by a variable?
<p>Being quite new at JavaScript, I'm assuming the answer to my question is extremely simple and I just don't know what I'm doing, but here goes:</p>

<p>How do I write an if statement that checks the value of an array when the array name is determined by a variable.</p>

<p>For example, say I've got something like this:</p>

<pre><code>$x = 2

arr1 = [1, 1]
arr2 = [2, 2]
</code></pre>

<p>and I want to determine which array I examine based on the value of x.  The way I'm trying it is below, but I'm quite certain that isn't right:</p>

<pre><code>if (arr$x = 1)
alert ('2)
</code></pre>
