title: Javascript equality triple equals but what about greater than and less than?
body: <p>I was explaining to a colleague that you should use <code>===</code> and <code>!==</code> (and <code>&gt;==</code> and <code>&lt;==</code> of course) when comparing variables in JavaScript so that it doesn't coerce the arguments and get all froopy and confusing but they asked me a two part question that I did not know the answer to and thought I would ask the experts here, specifically it is:</p>
  
  <blockquote>
    <p>What about <code>&gt;</code> and <code>&lt;</code> - when they compare do they also coerce the arguments or not - why isn't there some sort of <code>&gt;&gt;</code> and <code>&lt;&lt;</code> operator (probably need to be some other syntax as I would guess they would be bit shift operators if it is going along the whole C style but you get the gist)?</p>
  </blockquote>
  
  <p>So I can write a test to find the answer to the first part, which I did, here it is:</p>
  
  <pre><code>// Demo the difference between == and ===
  alert(5 == "5");
  alert(5 === "5");   
  
  // Check out what happens with &gt;
  alert(5 &gt; "4");    
  alert(5 &gt; 4);
  </code></pre>
  
  <p>and it returned:</p>
  
  <pre><code>true
  false
  
  true
  true
  </code></pre>
  
  <p>so it does look like the <code>&gt;</code> is doing the coercion since <code>&gt; "4"</code> and <code>&gt; 4</code> return the same result. so how about the second part...</p>
  
  <p>Is there some sort of operator for <code>&gt;</code> and <code>&lt;</code> that do not coerce the type (or how can I change my test to perform the test safely)?</p>