프로퍼티 어트리뷰트
-
16장 프로퍼티 어트리뷰트 | 모던 자바스크립트 Deep Dive모던 자바스크립트 Deep Dive 2023. 11. 14. 21:41
프로퍼티 어트리뷰트와 프로퍼티 디스크립터 객체 자바스크립트 엔진은 프로퍼티를 생성할 때 프로퍼티의 상태를 나타내는 프로퍼티 어트리뷰트를 기본값으로 자동 정의한다. 프로퍼티의 상태란 프로퍼티의 값(value), 값의 갱신 가능 여부(wrtable), 열거 가능 여부(enumerable), 재정의 가능 여부(configurable)를 말한다. 프로퍼티 어트리뷰트는 자바스크립트 엔진이 관리하는 내부 상태 값인 내부 슬롯 [[Value]], [[Writable]], [[Enumerable]], [[Configurable]] 이다. 따라서 프로퍼티 어트리뷰트에 직접 접근 할 수 없지만 Object.getOwnPropertyDescriptor 메서드를 사용하여 간접적으로 확인할 수는 있다. const person ..