DEV Community 👩‍💻👨‍💻

Cover image for Url in Javascript
Dhanush N
Dhanush N

Posted on

Url in Javascript

In javascript you can easily create a new URL using the below code

const url = new URL('')
Enter fullscreen mode Exit fullscreen mode

The url.searchParams.set is used to set param values to the url


// Output:
Enter fullscreen mode Exit fullscreen mode

This URL API is safely supported in all modern browsers.

Hope you learned something new. Thank you for reading ❤️

For more insights connect with me via Twitter & Github

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.