URLSearchParams: getAll() メソッド
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.
getAll()
は URLSearchParams
インターフェイスのメソッドで、指定された検索パラメーターに関連付けられたすべての値を配列として返します。
メモ: この機能はウェブワーカー内で利用可能です。
構文
js
getAll(name)
引数
name
-
返すパラメーターの名前。
返値
文字列の配列です。
例
js
let url = new URL("https://example.com?foo=1&bar=2");
let params = new URLSearchParams(url.search);
// 2 つ目の foo パラメーターを追加します。
params.append("foo", 4);
console.log(params.getAll("foo")); // ["1","4"] を表示します。
仕様書
Specification |
---|
URL # dom-urlsearchparams-getall |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getAll |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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.