Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

OperatorDescriptionComparingReturns
==equal tox == 8false
x == 5true
x == "5"true
===equal value and equal typex === 5true
x === "5"false
!=not equalx != 8true
!==not equal value or not equal typex !== 5false
x !== "5"true
x !== 8true
>greater thanx > 8false
<less thanx < 8true
>=greater than or equal tox >= 8false
<=less than or equal tox <= 8true

 Oddities of Null

 

 

 

false
EquationReturns
 == 
 if (x ==1)true if x = 1;
 if (x ==1)true if x = '1';
 if (x ==0)true if x = 0;
  if (x ==0)true if x = null;
  if (x ==0)true if x = undefined;
 === 
 if (x ===1)  true if x = 1;
 if (x ===1)  false if x = '1';
 if (x ===0)  true if x = 0;
 if (x ===0)  false if x = null;
 if (x ===0) 
  
  
 
 
 false if x = undefined;