The difference between JavaScript = and =: javascript
Differences between JavaScript = and =
==And === both determine whether the variables on both sides are equal, but there are also differences
I. =
===Indicates a constant. First, compare whether the data types of variables on both sides are equal, and then compare whether the values of variables on both sides are equal;
Var param1 = '1', param2 = '1 ';
Param1 = param2; // The type and value are both equal to true
Var param3 = 1;
Param1 = param3; // The type is not equal to the value. false
Var param4 = 2;
Param1 = param4; // The type and value are not equal. false
Var param1 = null, param2 = undefined;
Param1 = param2; // false
2. =
= Equal means that only the values of the variables on both sides are equal
Var param1 = '1', param2 = '1 ';
Param1 = param2; // The type and value are both equal to true
Var param3 = 1;
Param1 = param3; // The type is not equal and the value is true.
Var param4 = 2;
Param1 = param4; // The type and value are not equal. false
Var param1 = null, param2 = undefined;
Param1 = param2; // true