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.
io error: No such file or directory (os error 2) (/home/runner/work/yari/yari/mdn/translated-content/files/zh-cn/web/api/xmlhttprequest_api/index.md)
备注: 此特性在 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.
浏览器兼容性
BCD tables only load in the browser