FormData.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.
备注: 此特性在 Web Worker 中可用。
FormData.keys()
该方法返回一个迭代器(iterator
),遍历了该 formData 包含的所有 key,这些 key 是 USVString
对象。
语法
js
formData.keys();
返回值
返回一个迭代器( iterator
)。
示例
js
// 先创建一个 FormData 对象
var formData = new FormData();
formData.append("key1", "value1");
formData.append("key2", "value2");
// 输出所有的 key
for (var key of formData.keys()) {
console.log(key);
}
结果如下:
key1 key2
规范
No specification found
No specification data found for api.FormData.keys
.
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 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keys |
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.