Earlier than understanding the distinction between “==” vs “===” in JavaScript lets learn about what are the == and != operator.
== vs !=
so the double equals (==) operator use to verify if two values are equals and never equals (!=) if the 2 values are usually not equal
and its return kind is all the time boolean like true **or **false.
In == and != each operater do kind conversion earlier than evaluating the weather For e.g : – 2 == ‘2’ so on this == function do kind conversion implicitly like earlier than evaluating it’ll do implicitly kind coercion like 2 == Quantity(‘2’) after which it’ll present output as *true **so that is what occurs after we compares utilizing == operater earlier than displaying output it add string ‘2’ worth in quantity fucntion and convert into quantity 2 and the evaluating’s we get the output as a real which 2 == 2
**for E.g *
let xxx = 2;
let xxxx = '2';
console.log(xxx == xxxx);// true
Now Verify with === operater can also be referred to as as strictly equality operator thats means it won’t do any kind conversion internally
For E.g:
let x = 1;
let y = '1'
console.log(x===y)// output will false