I don't seem to be able to add parameters/queries to the URL. I'm trying to add parameters to the url. I'm trying to do it with .set() and .append() but neither seems to do what I thought it'd do. Am I misunderstanding what those methods are meant to do. The desired output should be:
Code:
const url = new URL('/v2/top-headlines', 'http://newsapi.org')
const params = new URLSearchParams(url.search);
params.set('country', 'gb');
params.append('q', 'some_word')
console.log(url); // All good http://newsapi.org/v2/top-headlines
console.log(url.search); // empty object
console.log(params); // Empty string