Headers: entries() メソッド
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
メモ: この機能はウェブワーカー内で利用可能です。
Headers.entries()
メソッドは、このオブジェクトに含まれるすべてのキーと値のペアを走査するイテレーターを返します。それぞれのペアのキーと値は両方とも String
オブジェクトです。
構文
js
entries()
引数
なし。
返値
イテレーターを返します。
例
js
// Headers テストオブジェクトを作成
const myHeaders = new Headers();
myHeaders.append("Content-Type", "text/xml");
myHeaders.append("Vary", "Accept-Language");
// キーと値のペアを表示
for (const pair of myHeaders.entries()) {
console.log(`${pair[0]}: ${pair[1]}`);
}
結果は次の通りです。
content-type: text/xml vary: Accept-Language
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
entries |
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.