JS Browser
Use URL to practise browser-related data handling without changing the live page. URLSearchParams reads query values as strings.
Where to run this
This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.
A practical example
const page = new URL("https://example.test/tutorials?topic=arrays");
console.log(page.pathname);
console.log(page.searchParams.get("topic"));
What happens
The path is /tutorials and the topic is arrays.