标签:
//用apply把document当作this传入getId函数,帮助“修正”this; document.getElementById = (function (func) { return function () { return func.apply(document, arguments); } })(document.getElementById); //调用 var getId = document.getElementById; var div = getId(‘div2‘); //函数判断 var Type = {}; for (var i = 0, type; type = [‘String‘, ‘Array‘, ‘Number‘][i++];) { (function (type) { Type[‘is‘ + type] = function (obj) { return Object.prototype.toString.call(obj) === ‘[object ‘ + type + ‘]‘; } })(type); };
标签:
原文地址:http://www.cnblogs.com/jasonoiu/p/Classic-JS.html