title: How do I check if an array includes a value in JavaScript?
body: <p>What is the most concise and efficient way to find out if a JavaScript array contains a value?</p>
  <p>This is the only way I know to do it:</p>
  <pre><code>function contains(a, obj) {
      for (var i = 0; i &lt; a.length; i++) {
          if (a[i] === obj) {
              return true;
          }
      }
      return false;
  }
  </code></pre>
  <p>Is there a better and more concise way to accomplish this?</p>
  <p>This is very closely related to Stack Overflow question <em><a href="https://stackoverflow.com/questions/143847/best-way-to-find-an-item-in-a-javascript-array">Best way to find an item in a JavaScript Array?</a></em> which addresses finding objects in an array using <code>indexOf</code>.</p>