--- title: WeakSet.prototype.has() slug: Web/JavaScript/Reference/Global_Objects/WeakSet/has tags: - ECMAScript 2015 - JavaScript - Method - Prototype - WeakSet translation_of: Web/JavaScript/Reference/Global_Objects/WeakSet/has ---
has() メソッドは、特定の値をもつ要素が WeakSet オブジェクト内に存在するかどうかを示す真偽値を返します。
ws.has(value);
valueWeakSet オブジェクトに存在するかテストする値です。WeakSet オブジェクト内に特定の値をもつ要素が存在していたら true を返します。さもなければ false を返します。var ws = new WeakSet();
var obj = {};
ws.add(window);
mySet.has(window); // returns true
mySet.has(obj); // returns false
| 仕様書 |
|---|
| {{SpecName('ESDraft', '#sec-weakset.prototype.has', 'WeakSet.prototype.has')}} |
{{Compat("javascript.builtins.WeakSet.has")}}