searchParams each code example
Example: javascript foreach url parameter
// Create a test URLSearchParams object
var searchParams = new URLSearchParams("key1=value1&key2=value2");
// Log the values
searchParams.forEach(function(value, key) {
console.log(value, key);
});