* Javascript RegEx Api The RegExp object RegExp 글로벌 오브젝트는 3가지 사용을 제시한다. var a = new RegExp("\\b[\\w]{4}\\b","g"); //match all four letter words //same as... a = /\b\w{4}\b/g; a.constructor //RegExp() "(penalty)Lampard, Frank(1-0)".match(/\b([\w]+),\s?([\w]+)/g); RegExp.leftContext //"(penalty)" RegExp.rightContext //"(1-0)" RegExp.$1 //"Lampard" RegExp.$2 //"Frank" var a = /\b[a-z]{10,}\b/i; //m..
Invoke a property alert(this); //window var a = { b : function(){ return this; } }; a.b(); //a; a['b'](); //a; var c = {}; c.d = a.b; c.d() //c Invoke a variable var a = { b : function() { return this; } }; var foo = a.b; foo() // window var a = { b: function(){ var c = function() { return this; } return c(); } }; a.b(); //window var a = { b : function() { return (function() { return this;})() }..
String.prototype.split(separator, limit) "85@@86@@53".split("@@"); //['85', '86', '53']; "bannana".split(); //["banana"]; "원,투,쓰리".split(",",2); // ["원","투"] Array.prototype.join(separator) 배열을 스트링으로 변환 합니다. ["slugs","snails","puppy dog's tails"].join(' and '); //"slugs and snails and puppy dog's tails" ['Giants', 4, 'Rangers', 1].join(' '); //"Giants 4 Rangers 1" [1962,1989,2002,2010].join(); /..