From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- .../global_objects/object/isextensible/index.html | 110 +++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 files/ko/web/javascript/reference/global_objects/object/isextensible/index.html (limited to 'files/ko/web/javascript/reference/global_objects/object/isextensible/index.html') diff --git a/files/ko/web/javascript/reference/global_objects/object/isextensible/index.html b/files/ko/web/javascript/reference/global_objects/object/isextensible/index.html new file mode 100644 index 0000000000..bfe247c6e8 --- /dev/null +++ b/files/ko/web/javascript/reference/global_objects/object/isextensible/index.html @@ -0,0 +1,110 @@ +--- +title: Object.isExtensible() +slug: Web/JavaScript/Reference/Global_Objects/Object/isExtensible +tags: + - ECMAScript 5 + - JavaScript + - Method + - Object +translation_of: Web/JavaScript/Reference/Global_Objects/Object/isExtensible +--- +
{{JSRef}}
+ +

Object.isExtensible() 메서드는 객체가 확장 가능한지(객체에 새 속성을 추가할 수 있는지 여부)를 결정합니다.

+ +
{{EmbedInteractiveExample("pages/js/object-isextensible.html")}}
+ + + +

구문

+ +
Object.isExtensible(obj)
+ +

매개변수

+ +
+
obj
+
판별할 객체.
+
+ +

반환 값

+ +

객체의 확장 가능 여부를 나타내는 {{jsxref("Boolean")}}.

+ +

설명

+ +

객체는 기본으로 확장 가능입니다: 새로운 속성이 추가될 수 있고 ({{jsxref("Object.proto", "__proto__")}} {{deprecated_inline}} 속성을 지원하는 엔진에서는) 수정될 수 있습니다. 객체는 {{jsxref("Object.preventExtensions()")}}, {{jsxref("Object.seal()")}} 또는 {{jsxref("Object.freeze()")}}를 사용하여 확장 불가로 표시될 수 있습니다.

+ +

예제

+ +
// 새로운 객체는 확장 가능입니다.
+var empty = {};
+Object.isExtensible(empty); // === true
+
+// ...하지만 변경될 수 있습니다.
+Object.preventExtensions(empty);
+Object.isExtensible(empty); // === false
+
+// 봉인된 객체는 정의에 의해 확장 불가입니다.
+var sealed = Object.seal({});
+Object.isExtensible(sealed); // === false
+
+// 동결된 객체 또한 정의에 의해 확장 불가입니다.
+var frozen = Object.freeze({});
+Object.isExtensible(frozen); // === false
+
+ +

주의

+ +

ES5에서, 이 메서드의 인수가 비객체(원시형)인 경우, 그러면 {{jsxref("TypeError")}}가 발생합니다. ES6에서, 비객체 인수는 확장 불가인 보통 객체처럼 다뤄집니다, 그저 false를 반환하는.

+ +
Object.isExtensible(1);
+// TypeError: 1은 객체가 아닙니다 (ES5 코드)
+
+Object.isExtensible(1);
+// false                         (ES6 코드)
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + + + + + + +
명세상태설명
{{SpecName('ES5.1', '#sec-15.2.3.13', 'Object.isExtensible')}}{{Spec2('ES5.1')}}초기 정의. JavaScript 1.8.5에서 구현됨.
{{SpecName('ES6', '#sec-object.isextensible', 'Object.isExtensible')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-object.isextensible', 'Object.isExtensible')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ + + +

{{Compat("javascript.builtins.Object.isExtensible")}}

+ +

같이 보기

+ + -- cgit v1.2.3-54-g00ecf