title: What is the fastest way to compare strings in JavaScript?
body: <p>I have two strings and I need to know whether they are equal.</p>
  
  <p>I have previously done this: str1 === str2 , but I wonder if there is a faster way to compare two strings.</p>
  
  <p>The strings are fairly short being 15-25 characters long. My problem is that I am iterating through a lot of strings and it is taking quite a long time.</p>
  
  <p>I have a lot of comparisons in a structure like this:</p>
  
  <pre><code>If(str === str1)
  {
    do something
  }
  else if(str === str2)
  {
    do something
  }
  else if(str === str3)
  {
    do something
  }
  </code></pre>
  
  <p>The strings do not have any common structure or grouping.</p>