js typeof

if (that == null || "undefined" == typeof that) {
return;
}
        var bcd;  //未定义   undefined
        function Check_data_type(obj) {
            if ("undefined" == typeof obj) {
                return 0;
            }
        }
        var ts = Check_data_type(1);  //未定义  undefined
      var bcd;  //未定义   undefined
        bcd = bcd || {}; //当bcd为未定义时,直接赋值为对象
        bcd.abcd = bcd.abcd || {}; // 当bcd为未定义时候 报错;
        var abc=null;
        //abc = abc || {}; //abc 为null 把abc 赋值为对象
        abc = abc || ""; //为 null 把abc的 赋值为空字符串

猜你喜欢

转载自www.cnblogs.com/enych/p/11566845.html