1. Original type (6 kinds): Number,string,boolean,null,undefined,object (Function,array,date)
2. Implicit conversion: "37"-7//30
"37" +7//377
Note the use of-+-rule conversion type:
(1) num-0: Converts num type to number;
(2) num+ "": Converts the NUM type to a string;
2. = = operator
"1.23" = 1.23: Strings and numbers are compared, the strings are converted to numbers and then compared;
0 = false;
Null = = undefined;
New Object () = new Object ();
[1,2] = = [1,2];
3. = = = Strictly equal To
A = = = B:
Returns False if the type is different;
The same type: (1) NULL = = NULL;
(2) undefined = = undefined;
(3) Nan!= nan; (Neither Nan nor any number is equal);
(4) New Object ()!= new Object ();
4.a==b
same type, same = = =
Type is different, try type conversions and comparisons:
(1) NULL = = undefined equal;
(2) Number = = String: Converts a string to number, 1== "1.0"//true;
(3) Boolean = =? : Converts Boolean to number, true to 1,false conversion to 0, and then comparison;
(4) Object = = Number|string: Attempt to convert object to base type, new string ("hi") = = "HI"
GitHub home: https://github.com/chenyufeng1991. You are welcome to visit.