To infinity/Javascript 이론
-
[Javascript] 프로퍼티 어트리뷰트 (프로퍼티 상세속성 바꾸기)To infinity/Javascript 이론 2021. 6. 13. 12:14
2021.06.13 Ver1 자바스크립트: 객체object 기반의 프로그래밍 언어 (함수와 객체는 분리할 수 없다!) 원시타입: 단 하나의 값 객체타입: 다양한 타입의 값 객체 = 0개 이상의 프로퍼티로 구성된 집합 프로퍼티 = key + value 프로퍼티: 객체의 상태를 나타내는 값 (data) // 음, 객체의 값이라고 생각하면 될 듯 메서드: 프로퍼티를 참조하고 조작할 수 있는 동작 (behavior) // 프로퍼티 값이 함수일 경우 일반함수와 구분을 위해 메서드 method라고 부름, 객체 값 중 함수 1. 내부슬롯과 내부메서드 - 자바스크립트 엔진의 내부로직으로 직접 접근 및 호출이 불가능함. - 하지만 일부에 한해 간접적으로 접근할 수 있음 Ex. [[Prototype]] 내부슬롯에는 __p..
-
[Javascript] 실행컨텍스트 flow (코드실행 시 일어나는 과정)To infinity/Javascript 이론 2021. 6. 12. 15:33
2021.06.12 Ver1 책을 읽다보니 반복적으로 나오는 개념들이 있는데 처음엔 그냥 넘어갈 수 있었지만 읽는 챕터가 많아질수록 해당 개념에대한 물음표가 점점 많아지기 시작했다. (왜냐면 처음부터 순서대로 책을 읽지 않기 때문) 바로, 이때가 해당 개념에 대해 공부할 때 이다. 그래서 가장 기본이 되는 용어에 대해 공부하기로 한다. 전체적인 흐름에 대해 먼저 알고나서 해당 개념으로 넘어와서 그런지 좀 더 이해가 잘됐다. 그리고 컴퓨터 용어도 결국엔 하나의 '언어'이기 때문에 현재 우리가 사용하고 있는 '언어'인 '한국어'의 구성과 비교해서 같이 생각하면 좀 더 이해하기 쉬운 것 같다. 1. 기본용어 0. 리터럴 (literal) - 사람이 이해할 수 있는 문자와 기호를 사용해 값을 생성하는 표기법 (..
-
[Javascript] 스코프 scope (유효범위)To infinity/Javascript 이론 2021. 6. 10. 23:57
작성일: 2021.06.10, Ver1 1. 스코프란? - 기본적이고 중요한 내용임. - 자바스크립트의 스코프는 다른 언어의 스코프와 구별되는 특징이 있으므로 주의 (함수 레벨 스코프) 특징을 범위설정방법과 검색규칙 두가지로 나눠보자. 1) 식별자가 유효한 범위를 결정 - 모든 식별자(변수이름, 함수이름, 클래스 이름 등)는 자신이 선언된 위치에 의해 자신의 유효범위가 결정됨. (ex. 함수몸체 내에서 선언된 변수는 함수몸체 내에서만 유효. 변수는 가장 바깥영역, 코드블록, 함수몸체 내에서도 유효.) (1) 자바스크립트는 렉시컬 스코프 (lexical scope)임 - 동적스코프(dynamic scope): 함수를 어디서 호출했는가에 따라 함수의 상위 스코프를 결정 - 렉시컬스코프 또는 정적 스코프(st..
-
[Javascript] 모듈 ModuleTo infinity/Javascript 이론 2021. 6. 10. 23:56
작성일: 2021.06.10, Ver1 1. 모듈이란? - 애플리케이션을 구성하는 개별적 존재. 즉, 애플리케이션과 분리되어 존재 (애플리케이션 내에 있는 독립적인 존재) - 재사용가능한 코드조각, 자신만의 파일 스코프(모듈 스코프)를 가짐 - 모듈 내부에서 선언한 모든 식별자는 해당 모듈 내부에서만 참조할 수 있음. (즉, 남친이 나를 애칭으로 '귀요미'라고 부르면 그건 남친과 나와의 관계(모듈)에서만 해당되는 호칭이고 다른 곳에선 그 누가 '귀요미'라고 불러도 나는 반응하지 않는다.) - 공개가 필요한 자산에 한정하여 명시적으로 선택적 공개가 가능 -> export - 모듈 사용자는 공개한 자산 중 일부, 전체를 자신의 스코프 내로 불러들여 재사용 -> import (누군가 나를 '귀요미'라고 부를 ..