URLSearchParams: keys() メソッド
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
メモ: この機能はウェブワーカー内で利用可能です。
keys()
は URLSearchParams
インターフェイスのメソッドで、このオブジェクトに含まれるすべてのキーを反復処理できるイテレーター
を返します。 キーは文字列です。
構文
js
keys()
引数
なし。
返値
イテレーター
を返します。
例
js
// テスト用の URLSearchParams オブジェクトの作成
const searchParams = new URLSearchParams("key1=value1&key2=value2");
// キーの表示
for (const key of searchParams.keys()) {
console.log(key);
}
結果は次のとおりです。
key1 key2
仕様書
Specification |
---|
URL # dom-urlsearchparams-urlsearchparams |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keys |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
URL
インターフェイス