A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/WeakSet/has below:

WeakSet.prototype.has() - JavaScript | MDN

WeakSet.prototype.has()

Baseline Widely available

has() メソッドは、特定の値をもつ要素が WeakSet オブジェクト内に存在するかどうかを示す真偽値を返します。

試してみましょう
const weakset1 = new WeakSet();
const object1 = {};
const object2 = {};

weakset1.add(object1);

console.log(weakset1.has(object1));
// Expected output: true

console.log(weakset1.has(object2));
// Expected output: false
構文 引数
value

WeakSet オブジェクトに存在するかテストする値です。

返値
Boolean

WeakSet オブジェクト内に特定の値をもつ要素が存在していたら true を返します。さもなければ false を返します。

例 has() メソッドの使用
var ws = new WeakSet();
var obj = {};
ws.add(window);

mySet.has(window); // returns true
mySet.has(obj); // returns false
仕様書 ブラウザーの互換性 関連情報

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4