URLSearchParams API always return an empty object from url parsing

Viewed 274

My question is pretty simple. I try to use the URLSearchParams API. In my Google chrome browser console I got an empty object returned.

I simply applied the example given here google example

// Can also constructor from another URLSearchParams
const params = new URLSearchParams('q=search+string&version=1&person=Eric');

console.log(params.get('q') === "search string");
console.log(params.get('version') === "1");
console.log(Array.from(params).length === 3);

But I always got an empty object

console output

0 Answers
Related