Reflect.isExtensible()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.
Reflect.isExtensible()
정적 메서드는 객체의 확장 가능 여부, 즉 속성을 추가할 수 있는지 판별합니다. Object.isExtensible()
과 유사하지만 차이점도 있습니다.
시도해보기
const object1 = {};
console.log(Reflect.isExtensible(object1));
// Expected output: true
Reflect.preventExtensions(object1);
console.log(Reflect.isExtensible(object1));
// Expected output: false
const object2 = Object.seal({});
console.log(Reflect.isExtensible(object2));
// Expected output: false
구문
js
Reflect.isExtensible(target);
매개변수
target
-
확장 가능 여부를 판별할 대상 객체.
반환 값
객체의 확장 가능 여부를 나타내는 Boolean
.
예외
설명
Reflect.isExtensible()
메서드는 Object.isExtensible()
와 유사하게, 객체에 새로운 속성을 추가할 수 있는지 판별합니다.
예제
Reflect.isExtensible()
사용하기
Object.isExtensible()
도 참고하세요.
js
// 새로운 객체는 확장 가능
var empty = {};
Reflect.isExtensible(empty); // === true
// ...하지만 바꿀 수 있음
Reflect.preventExtensions(empty);
Reflect.isExtensible(empty); // === false
// 봉인한 객체는 확장 불가능함
var sealed = Object.seal({});
Reflect.isExtensible(sealed); // === false
// 동결한 객체도 확장 불가능함
var frozen = Object.freeze({});
Reflect.isExtensible(frozen); // === false
Object.isExtensible()
과의 차이점
Reflect.isExtensible()
은 첫 번째 매개변수가 원시값이면 TypeError
를 던집니다. 반면 Object.isExtensible()
은 우선 객체로 변환을 시도합니다.
js
Reflect.isExtensible(1);
// TypeError: 1 is not an object
Object.isExtensible(1);
// false
명세
Specification |
---|
ECMAScript® 2025 Language Specification # sec-reflect.isextensible |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
isExtensible |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.