Javascript笔记03:易犯错的比较运算
1.比较两个值是否相等的常见运算:
"" == "0" //false
0 == "" //true
0 == "0" //true
false == "false" //false
false == "0" //false
false == undefined //false
false == null //false
null == undefined //false
"\t\r\n" == 0 //false
2.比较两个值是否全等的常见运算
"" === "0" //false
0 === "" //false
0 === "0" //false
false === "false" //false
false === "0" //false
false === undefined //false
false === null //false
null === undefined //false
"\t\r\n" === 0 //false
3.无穷大的比较
Infinity>10 //true
Infinity>"abc" //false
Infinity<"abc" //false
Infinity=="abc" //false
Infinity==NaN //false