web api instance method
URLSearchParams: keys() method
Available in workers
The keys() method of the URLSearchParams
interface returns an iterator allowing iteration
through all keys contained in this object. The keys are strings.
Syntax
keys()
Parameters
None.
Return value
Returns an iterator.
Examples
// Create a test URLSearchParams object
const searchParams = new URLSearchParams("key1=value1&key2=value2");
// Display the keys
for (const key of searchParams.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
- The
URLinterface.