IE上面自我调试 粗陋版本

var is ={
        types : ["Array", "Boolean", "Date", "Number", "Object", "RegExp", "String", "Window", "HTMLDocument"]
    };
    for(var i = 0, c; c = is.types[i ++ ]; ){
        is[c] = (function(type){
            return function(obj){
                return Object.prototype.toString.call(obj) == "[object " + type + "]";
            }
        )(c);
    }
    if(!window.console){
        window.console = {};
    }
    if(!window.console.log){
        window.console.log = function(msg){
            if(typeof msg == 'string';){
                alert(msg)
            }else if(is.Object(msg)){
                alert(JSON.stringify(msg));
            }
        };
    }

 

posted @ 2017-01-05 14:48  霏霏雪无声  阅读(64)  评论(0)    收藏  举报