title: Javascript: Comparing SINGLE Value Against MULTIPLE Values with OR Operands
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4728144/check-variable-equality-against-a-list-of-values">Check variable equality against a list of values</a><br>
    <a href="https://stackoverflow.com/questions/13944216/javascript-if-statement-with-multiple-permissible-conditions">Javascript if statement with multiple permissible conditions</a>  </p>
  </blockquote>
  
  
  
  <p>I must click the same 21 of 253 items (li) in a dropdown list (ul).</p>
  
  <p>Scrolling I'll have to do this for the same list on 500+ pages, I figured I could Javascript inject each ul, loop through and click each li which happens to be one of the 21. 
  It seems I cannot do something like</p>
  
  <pre><code> if(item[i] === ('aasdf'|'basdf'|'cwefw'|'asdfd'|'trehe'|'ferth'|'erthg'|'erthh'|'ierth'|'jeth'|'kerth'|'lerth'|'merth'|'psdfg'|'gregq'|'rsrgs'|'sress'|'srget'|'sergu'|'sdfgsv'))
  </code></pre>
  
  <p>Is there a syntactically cleaner way of writing this ugly if statement below?</p>
  
  <pre><code>var item = document.getElementById('myDropdownList').getElementsByTagName('li');
  
  for (i=0;i&lt;item.length;i++){
  
      if(item[i].innerText === 'Argentina' | item[i].innerText === 'Australia' | item[i].innerText === 'Brazil' | item[i].innerText === 'Canada' | item[i].innerText === 'China' | item[i].innerText === 'Colombia' | item[i].innerText === 'France' | item[i].innerText === 'Germany' | item[i].innerText === 'Indonesia' | item[i].innerText === 'India' | item[i].innerText === 'Italy' | item[i].innerText === 'Japan' | item[i].innerText === 'Malaysia' | item[i].innerText === 'Mexico' | item[i].innerText === 'Philippines' | item[i].innerText === 'Russia' | item[i].innerText === 'South Africa' | item[i].innerText === 'Sweden' | item[i].innerText === 'Switzerland' | item[i].innerText === 'United Kingdom' | item[i].innerText === 'USA'){
  
      item[i].click();
  
      }
  
  }
  </code></pre>