In javascript you can easily create a new URL using the below code
const url = new URL('https://github.com/DhanushNehru')
url.searchParams.set('tab','repositories')
The url.searchParams.set is used to set param values to the url
console.log(url.toString())
// Output: https://github.com/DhanushNehru?tab=repositories
This URL API is safely supported in all modern browsers.
Hope you learned something new. Thank you for reading β€οΈ
Top comments (0)