We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

FormData.keys()

这篇翻译不完整。请帮忙从英语翻译这篇文章

FormData.keys() 该方法返回一个迭代器(iterator),遍历了该 formData  包含的所有key ,这些 key 是 USVString 对象。

注意: 该方法在 Web Workers 可用。

语法

formData.keys();

返回值

返回一个迭代器( iterator)。

示例

// 先创建一个 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

规范

规范 状态 说明
XMLHttpRequest
keys() (as iterator<>)
Living Standard Initial definition

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 50.0 44 (44) ? (Yes) ?
Available in web workers 50.0 44 (44) ? (Yes) ?
Feature Android Android Webview Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support 未实现 50.0 44.0 (44) ? ? ? 50.0
Available in web workers 未实现 50.0 44.0 (44) ? ? ? 50.0

 

相关链接

文档标签和贡献者

此页面的贡献者: doudoudzj, Cattla
最后编辑者: doudoudzj,