본문 바로가기

javascript93

lexical grammer/어휘문법 명령문 끝에 자동으로 세미콜론을 추가 1. empty statement 2. let, const variable statement 3. import, exprt, module declaration 4. expression statement 5. debugger 6. continue, break, throw 7. return 그 외 1. 문법에서 허용하지 않는 행 종결 또는 "}"가 나타날 때 앞에 세미콜론을 삽입함. { 1 2 } 3 // is transformed by ASI into { 1 2 ;} 3; 2. 여기서 ++는 b와 ++사이에 줄 종결자가 발생하기 때문에 변수 b에 적용되는 후위연산자로 취급되지 않음. a = b ++c // is transformend by ASI into a = b; .. 2022. 1. 24.
First-class Function A programming language is said to have First-class functions when functions in that language are treated like any other variable. For example, in such a language, ① a function can be passed as an argument to other functions, ② can be returned by another function and ③can be assigned as a value to a variable. ① a function can be passed as an argument to other functions function sayHello() { retur.. 2022. 1. 24.
closure A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function’s scope from an inner function. In JavaScript, closures are created every time a function is created, at function creation time. Lexical scoping : 프로그램 내에서 선언된 변수의 위치에 의하여 그 변수가 사용될 범위가 결정되는것. fu.. 2022. 1. 23.
변수, type, 할당, return script defer로 작성하는 것이 제일 좋음. HTML을 parsing하는 동안 다운받고 페이지가 준비되면 실행함. 여러개일 경우 순서대로 실행됨. 자바스크립트에서 중요한것 : 입력/연산/출력 변수(var는 blcok scope가 없음. 사용하지 않음) 1. let (mutable) 2. const 값이 정해지면 바꿀 수 없음. (immutable) variable type 1. primitive, single item : number, string, boolean, null, undefined, symbol 2. object(primitive type을 제외하고 모두), box container 3. function, first-class function boolean false : 0, null.. 2022. 1. 23.