minte9
LearnRemember



Boolean

All comparitions operators return a boolean value.
 
/**
 * A comparition result can be assign to a variable
 */

let a = 2 > 1;
let b = 2 != 1;

console.log(a); // true
console.log(b); // true

Strict

The strict equality operator leaves less room for errors.
 
/**
 * Javascript converts the values to numbers, 
 * when comparing different types
 * 
 * Strict equality operator is recommended, 
 * no type conversion
 */

console.assert( '2' > 1 );      // pass     Wrong
console.assert( '01' == 1 );    // pass     Wrong
console.assert( '01' === 1 );   // failed   Correct



  Last update: 432 days ago