Firefox Tomorrow

web api instance method

FormData: keys() method

View on MDN ↗

Available in workers

The FormData.keys() method returns an iterator which iterates through all keys contained in the FormData. The keys are strings.

Syntax

keys()

Parameters

None.

Return value

An iterator of FormData’s keys.

Examples

const formData = new FormData();
formData.append("key1", "value1");
formData.append("key2", "value2");

// Display the keys
for (const key of formData.keys()) {
  console.log(key);
}

The result is:

key1
key2

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also