Checking value exists in an array position
<p>I have a large array called "data".</p>

<p>At the 10th array position i have this at its data value:</p>

<pre><code>[10] =&gt; 1,2 
</code></pre>

<p>Now what im trying to do in JS is something like this:</p>

<pre><code> i = 1;
 if(i in data[10]){
   //great success, very nice!
 }
</code></pre>

<p>I thought comma separated data might act like an array with the "IN" method, but its not working. I get this error:</p>

<pre><code> Uncaught TypeError: Cannot use 'in' operator to search for '1' in 1,2 
</code></pre>

<p>What would be the correct solution for my problem ?</p>
