第1章数据类型技巧.pptx

JavaScript深入浅出;1;var num = 32;;number string boolean null undefined;2;;a == b;a === b;a == b;3;number string boolean null undefined;;4;类型检测;typeof(undefined) ) === “undefined” typeof(new Object() ) === “object” typeof( [1, 2] ) === “object” typeof(NaN ) === “number” typeof(null) === “object”;Why typeof null === “object”;obj instanceof Object;;Object.prototype.toString.apply([]); === “[object Array]”; Object.prototype.toString.apply(function(){}); === “[object Function]”; Object.prototype.toString.apply(null); === “[object Null]” Object.prototype.toString.apply(undefined); === “[object Undefined]” IE6/7/8 Object.prototype.toString.apply(null) 返回”[object Object]”;类型检测;类型检测小结;5;;Practise 2;5 – “4” 5 + “4” +!{}[true] +[1] +[1, 2] 7 – “a” 7 / 0 …;5 + “4” 5 + null 4 == “4.00” 4 === “4.00” null == undefined 0 == false 0 == null null == false;谢谢

文档评论(0)

1亿VIP精品文档

相关文档