pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/WeakSet/WeakSet

ype="module">

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

WeakSet() コンストラクター

Baseline 広く利用可能

この機能は広く実装されており、多くのバージョンの端末やブラウザーで動作します。2015年9月以降、すべてのブラウザーで利用可能です。

WeakSet() コンストラクターは WeakSet オブジェクトを作成します。

構文

js
new WeakSet()
new WeakSet(iterable)

メモ: WeakSet()new 付きでのみ構築できます。new なしで呼び出そうとすると、 TypeError が発生します。

引数

iterable 省略可

反復可能オブジェクトが渡された場合、すべての要素が新しい WeakSet に追加されます。 null は undefined として扱われます。

WeakSet オブジェクトの使用

js
const ws = new WeakSet();
const foo = {};
const bar = {};

ws.add(foo);
ws.add(bar);

ws.has(foo); // true
ws.has(bar); // true

ws.delete(foo); // foo を set から削除
ws.has(foo); // false, foo は削除済み
ws.has(bar); // true, bar は残っている

foo !== bar であることに注意してください。これらは似たオブジェクトですが、まったく同じオブジェクトではありません。したがって、両方のオブジェクトが set に追加されます。

仕様書

仕様書
ECMAScript® 2027 Language Specification
# sec-weakset-constructor

ブラウザーの互換性

関連情報

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy