IDBKeyRange: includes() メソッド

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2021.

We'd love to hear more about your role and the company you work for
Please help us by answering a few questions.

メモ: この機能はウェブワーカー内で利用可能です。

includes()IDBKeyRange インターフェイスのメソッドで、指定のキーがこのキーの範囲に含まれるかを表す論理値を返します。

構文

js
includes(key)

引数

key

キーの範囲に含まれるかをチェックするキーです。任意の型を使用可能です。

返値

論理値です。

例外

DataError DOMException

指定されたキーが有効なキーでないとき投げられます。

js
const keyRangeValue = IDBKeyRange.bound("A", "K", false, false);

keyRangeValue.includes("F");
// true を返します

keyRangeValue.includes("W");
// false を返します

仕様書

Specification
Indexed Database API 3.0
# ref-for-dom-idbkeyrange-includes①

ブラウザーの互換性

関連情報