FormData.values()

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.values() 方法返回一个允许遍历 FormData 中所有值的迭代器。这些值是字符串或是 Blob 对象。

语法

js
formData.values();

返回值

返回一个迭代器.

示例

js
//创建一个 FormData 测试对象
var formData = new FormData();
formData.append("key1", "value1");
formData.append("key2", "value2");

//显示值
for (var value of formData.values()) {
  console.log(value);
}

结果为:

value1
value2

规范

No specification found

No specification data found for api.FormData.values.
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

参见