The primary difference between the == or === operators in JavaScript is that the == operator converts the operands before comparing, while the === operator compares both the data types and the values.

(==)

When we want to compare two values, one string, and another number, it will convert the string to the number type, then compare the results.

let a = 10;
let b = '10';
console.log(a == b);  // true

(===)

let a = 10;
let b = '10';
console.log(a === b);  // false

BY Best Interview Question ON 18 Aug 2022

Suggest An Answer