title: Using indexOf method to find value in a 2D array
body: <p>I want to ask a question that I have about a 2D array in JavaScript, similar to this:</p>
  
  <pre><code>var array = [[2,45],[3,56],[5,67],[8,98],[6,89],[9,89],[5,67]]
  </code></pre>
  
  <p>That is, on every index, I have an array as well.</p>
  
  <p>Suppose that I have a value in my second index like <code>56</code>, and I want the corresponding 1st index (i.e. 3 in above example).</p>
  
  <p>I can do it using a loop (if no other option), but is there any better way?</p>
  
  <p>Also, I know <code>indexOf</code> method in JavaScript, but it's not returning the index when I call it like this:</p>
  
  <pre><code>array.indexOf(56);
  </code></pre>
  
  <p>Any insight will be helpful.</p>