You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
8000
Object.defineProperty 객체에 직접 속성을 지정/수정한 후 객체 반환 #16
property descriptor
서술자는 data descriptor이거나 accessor descriptor 둘 중 하나여야 한다.
두 유형이 동시에 갖는 키
configurable : 이 속성의 기술 속성(writable제외)을 변경 & 삭제 가능 - 기본값 : false
enumerable : 객체의 속성 열거시 이 속성이 노출된다. - 기본값 : false
data descriptor가 선택적으로 갖는 키
value : 속성에 연관된 값 - 기본값 : undefined
writable: 할당연산자로 속성의 값을 바꿀 수 있다. - 기본값 true
accessor descriptor가 선택적으로 갖는 키
get
set
점 구문으로 프로퍼티 할당 vs Object.defineProperty로 할당
varo={};o.a=1;// 위의 표현은 아래와 같다:Object.defineProperty(o,'a',{value: 1,writable: true,configurable: true,enumerable: true});// 만약 다음과 같이 표현한다면,Object.defineProperty(o,'a',{value: 1});// 아래의 의미를 지니게 된다:Object.defineProperty(o,'a',{value: 1,writable: false,configurable: false,enumerable: false});
Activity