What is the difference between == and === operators?

== is the equality operator, which checks if the two values are equal or not. It doesn’t check the type of the two values. For example:

let a = 10;
let b = “10”;

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

=== is the strict equality operator, which checks if the two values are equal and of the same type. For example:

let a = 10;
let b = “10”;

console.log(a === b); // returns false

What is the difference between == and ===?

== is the comparison operator, also known as the “equal to” operator. It checks if the two values on either side of the operator are equal. For example:

let x = 5;
let y = 5;
x == y // returns true

=== is the strict comparison operator, also known as the “equal value and equal type” operator. It checks if the two values on either side of the operator are equal and of the same type. For example:

let x = 5;
let y = ‘5’;
x === y // returns false

What is the difference between == and ===?

== is the equality operator and is used to compare two values. It doesn’t check the data type of the two values being compared. For example:

let a = 10;
let b = “10”;
a == b // returns true

=== is the strict equality operator and is used to compare two values. It checks the data type of the two values being compared. For example:

let a = 10;
let b = “10”;
a === b // returns false