http://www.google.cn/music/js/music_js-941234969.js
其中的一段,判断变量类型,居然也能这么复杂:
typeOf = function(a) {
var c = typeof a;
if (c == "object") if (a) {
if (a instanceof Array || !(a instanceof Object) && Object.prototype.toString.call(a) == "[object Array]" || typeof a.length == "number" && typeof a.splice != "undefined" && typeof a.propertyIsEnumerable != "undefined" && !a.propertyIsEnumerable("splice")) return "array";
if (! (a instanceof Object) && (Object.prototype.toString.call(a) == "[object Function]" || typeof a.call != "undefined" && typeof a.propertyIsEnumerable != "undefined" && !a.propertyIsEnumerable("call"))) return "function"
} else return "null";
else if (c == "function" && typeof a.call == "undefined") return "object";
return c
};