晴明的博客园 GitHub      CodePen      CodeWars     

[js] 迷惑

#

            var a = {
                n: 1
            }
            var b = a;
            a.x = a = {
                n: 2
            }
            console.log(a.x);//undefined
            console.log(b.x)//Object {n: 2}

 #

            var foo = "11" + 2 - "1";
            console.log(foo);//111
            console.log(typeof foo);//number

#

            var foo = "11" + 2 + "1";
            console.log(foo);//'1121'
            console.log(typeof foo);//string

#property?

            var regexp = /:(\w+)/g;
            var str = ':method :url'.replace(regexp, function(match, property) {
                console.log(match);
                console.log(property);
            });

 

posted @ 2016-04-27 22:44  晴明桑  阅读(109)  评论(0)    收藏  举报