JS Coding Questions Logo
JS Coding Questions
#211💼 Interview💻 Code

How do you encode an URL

Advertisement

728x90

The encodeURI() function is used to encode complete URI which has special characters except (, / ? : @ & = + $ #) characters.

javascript
1var uri = "https://mozilla.org/?x=шеллы";
2
3var encoded = encodeURI(uri);
4
5console.log(encoded); // https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 41

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
211of476