title: Is the Set.has() method O(1) and Array.indexOf O(n)?
body: <p>I have seen in an answer that the <code>Set.has()</code> method is O(1) and <code>Array.indexOf()</code> is O(n).</p>
  
  <pre><code>var a = [1, 2, 3, 4, 5];
  a.indexOf(5);          
  
  
  s = new Set(a);
  s.has(5);              //Is this O(1)?
  </code></pre>
  
  <p>Is <code>Set.has()</code> really O(1) ?</p>