title: Do JavaScript arrays have an equivalent of Python’s “if a in list”?
body: <p>If I have a list in Python, I can check whether a given value is in it using the <code>in</code> operator:</p>
  
  <pre><code>&gt;&gt;&gt; my_list = ['a', 'b', 'c']
  
  &gt;&gt;&gt; 'a' in my_list
  True
  
  &gt;&gt;&gt; 'd' in my_list
  False
  </code></pre>
  
  <p>If I have an array in JavaScript, e.g.</p>
  
  <pre><code>var my_array = ['a', 'b', 'c'];
  </code></pre>
  
  <p>Can I check whether a value is in it in a similar way to Python’s <code>in</code> operator, or do I need to loop through the array?</p>