MDN self-hosted library · e01.org

URLSearchParams: getAll() method

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const url = new URL("https://example.com?foo=1&bar=2");
const params = new URLSearchParams(url.search);

// Add a second foo parameter.
params.append("foo", 4);

console.log(params.getAll("foo")); // ["1", "4"]