title: it's weird that the switch condition in javascript
body: <p>I find that these two below are equivalent, but is quit weird that, single <code>=</code> is not a relation operator but an assignment operator, why it works in the second one?</p>
  
  <p>First:</p>
  
  <pre><code>switch (true) 
    {
      case color == 'green':case color == 'red':case color == 'blue':case color == 'pink':
        alert('colorful')
        break;
      case color == 'black':case color == 'white':
        alert('classical')
        break;
      default:
        alert('dull')
        break;              
    }
  </code></pre>
  
  <p>Second:</p>
  
  <pre><code>switch (color) 
    {
      case color = 'green':case color = 'red':case color = 'blue':case color = 'pink':
        alert('colorful')
        break;
      case color = 'black':case color = 'white':
        alert('classical')
        break;
      default:
        alert('dull')
        break;              
    }
  </code></pre>