"==" is usually referred to as Loose Equality and on the other hand "===" is referred to as Strict Equality. Both of them are used for comparison in JavaScript.
"==" (Loose Equality / Double equals) operator transforms the type of the operand to the same type before the comparison. For better understanding, if we want to compare a string("20") with a number(20) JavaScript will convert the string to a number for an accurate comparison. During comparison whichever operands' type has lower precedence will get converted to the higher one.
The following is a list of the types ordered by "precedence," with the highest precedence type listed first:
null
andundefined
Boolean
Number
String
Symbol
Object
"==="(Strict Equality / Triple equals) operator as the name suggests is a strict operator in JavaScript. This operator checks for the data type of the operands along with the values, so if we compare a string("20") with a number(20) it will return false.
So the main difference between "==" & "===" in JavaScript is that "==" does the type conversion of the operands before comparison and on the other hand "===" will strictly check for the data types of operands along with the values.