URLSearchParams: entries() メソッド

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.

entries()URLSearchParams インターフェイスのメソッドは、このオブジェクトに含まれるすべてのキー/値のペアを反復処理できるイテレーターを返します。それぞれのペアのキーと値は文字列です。

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

構文

js
entries()

引数

なし。

返値

イテレーターを返します。

js
// テスト用の URLSearchParams オブジェクトの作成
const searchParams = new URLSearchParams("key1=value1&key2=value2");

// キー/値のペアの表示
for (const [key, value] of searchParams.entries()) {
  console.log(`${key}, ${value}`);
}

結果は次のとおりです。

key1, value1
key2, value2

仕様書

Specification
URL
# dom-urlsearchparams-urlsearchparams

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
entries

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Has more compatibility info.

関連情報

  • URL インターフェイス。