tencent cloud

All product documents
Tencent Cloud Observability Platform
URLSearchParams.forEach
Last updated: 2025-03-11 20:21:24
URLSearchParams.forEach
Last updated: 2025-03-11 20:21:24
URLSearchParams.forEach is used to traverse all key-value pairs from URLSearchParams via a callback function.
forEach(callback: (value: string, key: string, parent: URLSearchParams) => void): void

Parameters

Parameter
Type
Description
callback
function
The callback function, with value and key being the value and key name of the search parameter respectively, and parent being the current URLSearchParams instance object that calls forEach.

Return

Type
Description
void
No data returned.

Samples

Traverse all key-value pairs from URLSearchParams via a callback function:
import url from 'pts/url';

export default function() {
const params = new url.URLSearchParams('key1=value1&key2=value2');

// value1, key1, [object Object]
// value2, key2, [object Object]
params.forEach(function(value, key, searchParams) {
console.log(value, ', ', key, ', ', searchParams);
});
}

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support