Compare values in JavaScript array
<p>I have a variable like so:</p>

<pre><code>columnData = new Array(columnWidth, columnIndex);
</code></pre>

<p>both values are numbers</p>

<p>and then I want to do the following:</p>

<pre><code>thiscolumnWidth = columnData[1] WHERE columnData[2] == cellIndex;
</code></pre>

<p>the idea is that I want the <code>thiscolumnWidth</code> to be the value of the first value in the array of <code>columnData</code> where the second value <code>columnData</code> matches the <code>cellIndex</code> value.</p>

<p>The reason for doing it this way is because all of this sits inside a foreach loop so therefore it needs to find the correct array in memory! This <strong>ALL WORKS</strong> apart from the Where clause which doesn't exist in JS.</p>

<p>Can anyone help? Cheers</p>
