An Interest In:
Web News this Week
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
July 25, 2022 06:14 pm GMT
Original Link: https://dev.to/dhanushnehru/url-in-javascript-550d
Url in Javascript
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
Original Link: https://dev.to/dhanushnehru/url-in-javascript-550d
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To