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

WeakSet 객체는 약하게 유지되는(held, 잡아두는) 객체를 컬렉션에 저장할 수 있습니다.

+ +

구문

+ +
new WeakSet([iterable]);
+ +

매개변수

+ +
+
iterable
+
iterable 객체가 전달된 경우, 모든 객체 요소는 새로운 WeakSet에 추가됩니다. null은 undefined로 취급됩니다.
+
+ +

설명

+ +

WeakSet 객체는 객체 컬렉션입니다. WeakSet 내 객체는 오직 한 번만 발생할 수 있습니다. 즉, WeakSet 컬렉션 내에서 유일합니다.

+ +

{{jsxref("Set")}} 객체와 주된 차이는 다음과 같습니다:

+ + + +

속성

+ +
+
WeakSet.length
+
length 속성값은 0.
+
{{jsxref("WeakSet.prototype")}}
+
Set 생성자에 대한 프로토타입을 나타냅니다. 모든 WeakSet 객체에 속성을 추가할 수 있습니다.
+
+ +

WeakSet 인스턴스

+ +

모든 WeakSet 인스턴스는 {{jsxref("WeakSet.prototype")}}에서 상속합니다.

+ +

속성

+ +

{{page('ko/docs/Web/JavaScript/Reference/Global_Objects/WeakSet/prototype','속성')}}

+ +

메서드

+ +

{{page('ko/docs/Web/JavaScript/Reference/Global_Objects/WeakSet/prototype','메서드')}}

+ +

예제

+ +

WeakSet 객체 사용

+ +
var ws = new WeakSet();
+var obj = {};
+var foo = {};
+
+ws.add(window);
+ws.add(obj);
+
+ws.has(window); // true
+ws.has(foo);    // false, foo가 집합에 추가되지 않았음
+
+ws.delete(window); // 집합에서 window 제거함
+ws.has(window);    // false, window가 제거되었음
+
+ +

명세

+ + + + + + + + + + + + + + + + + + + +
명세상태설명
{{SpecName('ES2015', '#sec-weakset-objects', 'WeakSet')}}{{Spec2('ES2015')}}초기 정의.
{{SpecName('ESDraft', '#sec-weakset-objects', 'WeakSet')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ +

{{Compat("javascript.builtins.WeakSet")}}

+ +

같이 보기

+ + diff --git a/files/ko/web/javascript/reference/global_objects/weakset/prototype/index.html b/files/ko/web/javascript/reference/global_objects/weakset/prototype/index.html new file mode 100644 index 0000000000..ee3f439ae9 --- /dev/null +++ b/files/ko/web/javascript/reference/global_objects/weakset/prototype/index.html @@ -0,0 +1,141 @@ +--- +title: WeakSet.prototype +slug: Web/JavaScript/Reference/Global_Objects/WeakSet/prototype +tags: + - ECMAScript6 + - JavaScript + - Property + - WeakSet +translation_of: Web/JavaScript/Reference/Global_Objects/WeakSet +--- +
{{JSRef}}
+ +

WeakSet.prototype 속성(property)은 {{jsxref("WeakSet")}} 생성자에 대한 프로토타입을 나타냅니다.

+ +
{{js_property_attributes(0,0,0)}}
+ +

설명

+ +

{{jsxref("WeakSet")}} 인스턴스는 {{jsxref("WeakSet.prototype")}}에서 상속합니다. 모든 WeakSet 인스턴스에 속성 또는 메서드를 추가하기 위해 생성자의 프로토타입 객체를 사용할 수 있습니다.

+ +

WeakSet.prototype은 그 자체로 그냥 평범한 객체입니다:

+ +
Object.prototype.toString.call(WeakSet.prototype); // "[object Object]"
+ +

속성

+ +
+
WeakSet.prototype.constructor
+
인스턴스의 프로토타입을 생성한 함수를 반환합니다. 이는 기본으로 {{jsxref("WeakSet")}} 함수입니다.
+
+ +

메서드

+ +
+
{{jsxref("WeakSet.add", "WeakSet.prototype.add(value)")}}
+
WeakSet 객체에 주어진 값을 갖는 새로운 객체를 추가합니다.
+
{{jsxref("WeakSet.delete", "WeakSet.prototype.delete(value)")}}
+
value와 관련된 요소를 제거합니다. WeakSet.prototype.has(value)는 그 뒤에 false를 반환합니다.
+
{{jsxref("WeakSet.has", "WeakSet.prototype.has(value)")}}
+
WeakSet 객체 내 주어진 값을 갖는 요소가 존재하는 지 여부를 주장하는(asserting, 나타내는) boolean을 반환합니다.
+
{{jsxref("WeakSet.prototype.clear()")}} {{obsolete_inline}}
+
WeakSet 객체에서 모든 요소를 제거합니다.
+
+ +

스펙

+ + + + + + + + + + + + + + + + + + + +
스펙상태설명
{{SpecName('ES6', '#sec-weakset.prototype', 'WeakSet.prototype')}}{{Spec2('ES6')}}초기 정의.
{{SpecName('ESDraft', '#sec-weakset.prototype', 'WeakSet.prototype')}}{{Spec2('ESDraft')}} 
+ +

브라우저 호환성

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support36{{ CompatGeckoDesktop(34) }}{{CompatNo}}23{{CompatNo}}
Ordinary object{{CompatUnknown}}{{CompatGeckoDesktop("40")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureChrome for AndroidAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatNo}}{{CompatNo}}{{ CompatGeckoMobile(34) }}{{CompatNo}}{{CompatNo}}{{CompatNo}}
Ordinary object{{CompatUnknown}}{{CompatUnknown}}{{CompatGeckoMobile("40")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

참조

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