Open this example in the interactive library
Source code
const query = new URLSearchParams({ q: "hello world", page: "2" });
console.log(query.toString());
Sample output
q=hello+world&page=2

Build query parameters. A self-contained example using the JavaScript runtime.
Open this example in the interactive library
const query = new URLSearchParams({ q: "hello world", page: "2" });
console.log(query.toString());
q=hello+world&page=2