// 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);
}URLSearchParams: keys() method / notebook
URLSearchParams: keys() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.