JS中5种原始数据类型

1.js中5种原始数据类型

    number:整数/小数/NaN
    string:
    boolean:
    null:
    undefined:

2.js中会存在自动类型转换:当js引擎发现给的数据类型和需要的数据类型不一致时,会自动类型转换

   其他类型转为boolean
            * string--boolean:除了空字符串(""),其他都转为true
            * number--boolean:0 和 NaN转为false,其他为true
            * 对象:所有对象都为true
            * null和undefined:false


猜你喜欢

转载自blog.csdn.net/AlexKate/article/details/78641983