一段最短的代码,用上js所有关键字

newfunction() { 

    dobreak;while(typeofdeletethis); 

    for(vara;void 0;) 

        continue

    if(null) 

        with(0) 

    try{ 

        switch(1 in1 instanceof1) { 

            casefalse: 

            default:throwtrue

        } 

    }catch(a){}finally{}elsereturn  // console.log("去掉注释可以运行到这里") 

};

注: instanceof 用于判断一个变量是否某个对象的实例,如 var a=new Array();alert(a instanceof Array); 会返回 true ,同时 alert(a instanceof Object) 也会返回 true; 这是因为 Array object 的子类。再如: function test(){};var a=new test();alert(a instanceof test) 会返回 true

猜你喜欢

转载自blog.csdn.net/hjingtao/article/details/7803083
今日推荐