title: Finding if element exists in array
body: <p>in Python, if you use set() and <code>in</code> operator, you can see whether an exists in a set in O(1). However, in javascript, is it possible to do the same with the same time complexity? I have usually done</p>
  
  <pre><code>var arr = [1,2,3,4,5];
  if (arr.indexOf(3) != -1) return true; // element exists!
  </code></pre>
  
  <p>without being really sure about its efficiency.</p>