(expression) : 하위표현식 - 괄호로 묶은 작업을 하위표현식이라 함. ([a-z][a-z]){3} : 소문자 두개가 3번 필요. 총 6글자 \1, \2 ... : 하위표현식 참조 (자바스크립트의 경우 $를 사용) \n : 정규 표현식에서 n번째 하위표현식을 참조 ([a-z][a-z])-\1 : 소문자 두개와 - 그리고 다시 소문자 두개 : 총 4글자 ex) ab-cd , dd-cc 하위 표현식 참조는 치환에도 사용된다. 도메인 주소에 자동으로 링크걸기나 전화번호 형식을 굵게 표시하기 등. 문자열 1980-10-17 정규표현식 (\d{4})-(\d{2})-(\d{2}) 치환식 \1//\2//\3 결과 1980/10/17 ?= : 전방탐색 ( 부정형 ?! ) 문자열 http://drken.tist..
true == 1; //true! (converts true to bit value 1) true - false === 1 //true!!! "2" + 2; //22! "2" - 2; //0 "2" - - 2; //4 NaN == NaN; //false - this one sort of makes sense since NaN is any non-Number cast to a number NaN NaN; //false - whatever! "" == 0 //true undefined == null //false! "0" == 0 //true! "false" = false //false!!!' '\t\r\n ' == 0 //true!!! if(-1) {....} //true if("") {....} //fa..
1. simple Object Literal var myApp = {}; myApp.panel = {}; myApp.panel.toggleDisplay = function() { this.displayed = (this.displayed==="none")? "" : "none"; } myApp.panel.defaultWidth = 300; myApp.notepad = {}; myApp.notepad.writeable = true; myApp.notepad.font = 'helvetica'; myApp.notepad.setFont = function(theFont) { myApp.notepad.font = theFont; } //OK not inheritance at all. But best we can ..
1. Simple Object Literal myApp.notepad = {}; myApp.notepad.writeable = true; myApp.notepad.font = 'helvetica'; myApp.notepad.setFont = function(theFont) { myApp.notepad.font = theFont; } 2. Nested Object Literal myApp.notepad = { writeable: true, font: 'helvetica', setFont: function(theFont) { this.font = theFont; } } 3, Constructor using Object Literal myApp.Notepad = function(defaultFont) { va..