FormData.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.
备注: 此特性在 Web Worker 中可用。
FormData.entries()
方法返回一个 iterator
对象,此对象可以遍历访问 FormData
中的键值对。其中键值对的键是一个字符串对象;值是一个字符串或者 Blob
对象。
语法
js
entries()
返回值
返回 iterator
。
示例
js
// Create a test FormData object
var formData = new FormData();
formData.append("key1", "value1");
formData.append("key2", "value2");
// Display the key/value pairs
for (var pair of formData.entries()) {
console.log(pair[0] + ", " + pair[1]);
}
执行结果为:
key1, value1 key2, value2
规范
No specification found
No specification data found for api.FormData.entries
.
Check for problems with this page or contribute a missing spec_url
to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.
浏览器兼容性
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.