In the past, the equal sign "==" was always used, and the equal sign "===" was never used in JS. When these two operators only detect the equality of two objects, one performs type conversion and the other does not. The equals symbol will only return true before type conversion is not performed
var sNum="66";
var iNum=66;
alert(sNum ==iNum);//The output is true
alert(sNum===iNum);//The output is false
The first equal operator replaces sNum during comparison The value "66" is converted into a numeric type, and then compared with iNum, so it will return true
. However, the second comparison of congruent signs does not perform type conversion, so the comparison between string and numeric types cannot be true, so all Return false
There is also a non-congruent sign and non-equal sign
var sNum="66";
var iNum=66;
alert(sNum!=iNum); //Returns to false
alert(sNum!===iNum); //Returns to true
The first operator is easy for everyone to understand. The operator converts sNum into a numeric type. After converting to a numeric type, the two values are equal and return false
The second operator non-equal sign does not convert the sNum type, so sNum is not equal to iNum, so the return value is true
This is just one of my study notes haha.