FormData.entries()

备注: 此特性在 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.

浏览器兼容性

BCD tables only load in the browser

参见