title: javascript indexOf - exact match in a list / array
body: <p>I decided to use javascript indexOf to determine if a value exists in a list / array. This was working for me untill I realised that I need to find an <strong>exact</strong> match in the list.</p>
  
  <p>Here is my example code:</p>
  
  <pre><code>if (['eu', 'fr-CA', 'lt', 'sv', 'zh-CN', 'zh-TW'].indexOf('fr') &gt; -1) {
  </code></pre>
  
  <p>The above code will 'match' fr to fr-CA, which is a problem for me, as I must have an <strong>exact match to fr</strong> and not match to fr-CA.</p>
  
  <p>I thought that this would be straight forward, but I have searched SO and google, and cannot find an answer to getting the exact match.</p>