string == number (string ==> number)
ex:"42" == 42 ("42" ==> 42)
anytype == boolean (anytype ==> boolean)
ex:0 == false (0 ==> false)
当非布尔值转换为布尔值时,下列值转换为false:
""(空字符串)
0,-0,NaN
null,undefined
false
string == number (string ==> number)
ex:"42" == 42 ("42" ==> 42)
anytype == boolean (anytype ==> boolean)
ex:0 == false (0 ==> false)
当非布尔值转换为布尔值时,下列值转换为false:
""(空字符串)
0,-0,NaN
null,undefined
false
本文标题:JavaScript中使用==比较原生值时类型转换方向
本文链接:https://www.haomeiwen.com/subject/rjvrhctx.html
网友评论