المعرفة:: JavaScript الحالة::مؤرشفة المراجع:: JavaScript Essential Training


Comparison

// Unlike the strict equality operator, it attempts to convert and compare operands that are of different types.
console.log(1 == 1);
// expected output: true
 
console.log("hello" == "hello");
// expected output: true
 
console.log("1" == 1);
// expected output: true
 
console.log(0 == false);
// expected output: true
 
// Unlike the equality operator, the strict equality operator always considers operands of different types to be different.
console.log(1 === 1);
// expected output: true
 
console.log("hello" === "hello");
// expected output: true
 
console.log("1" === 1);
// expected output: false
 
console.log(0 === false);
// expected output: false