小编Suv*_*jah的帖子

什么时候是javascript`Null`中变量的数据类型?

实际上是否可以将Null数据类型作为typeof函数的返回值 - 如果是这样的话会产生哪种结果,何时实际上是该Null类型的变量 ?

    typeof myVAR; //gives me "undefined" before the variable declaration

    var myVAR;
    typeof myVAR; //also gives me "undefined"

    myVAR = null; //assigned the null object
    typeof myVAR; //gives me "Object" (which I guess makes sense because `null` is an object and that's what I assigned to the variable)
Run Code Online (Sandbox Code Playgroud)

javascript

3
推荐指数
1
解决办法
448
查看次数

标签 统计

javascript ×1