// Create a test URLSearchParams object
const searchParams = new URLSearchParams("key1=value1&key2=value2");
// Log the values
searchParams.forEach((value, key) => {
console.log(value, key);
});URLSearchParams: forEach() method / notebook
URLSearchParams: forEach() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.