FormData.keys() method returns an iterator allowing to go through all keys contained in this object. The keys are USVString 对象。

注意 : This method is available in Web 工作者 .

句法

formData.keys();
					

返回值

返回 iterator .

范例

// Create a test FormData object
var formData = new FormData();
formData.append('key1', 'value1');
formData.append('key2', 'value2');
// Display the keys
for (var key of formData.keys()) {
   console.log(key);
}
					

The result is:

key1
key2
					

规范

规范 状态 注释
XMLHttpRequest
The definition of 'keys() (as iterator<>)' in that specification.
实时标准 初始定义

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
keys Chrome 50 Edge 18 Firefox 44 IE ? Opera Yes Safari 11 WebView Android 50 Chrome Android 50 Firefox Android 44 Opera Android ? Safari iOS 11 Samsung Internet Android 5.0

图例

完整支持

完整支持

兼容性未知 ?

兼容性未知

另请参阅

元数据

  • 最后修改: