title: Check if an element is present in an array
body: <p>The function I am using now to check this is the following:</p>
  
  <pre><code>function inArray(needle,haystack)
  {
      var count=haystack.length;
      for(var i=0;i&lt;count;i++)
      {
          if(haystack[i]===needle){return true;}
      }
      return false;
  }
  </code></pre>
  
  <p>It works. What I'm looking for is whether there is a better way of doing this.</p>