Advertisement
728x90
The decodeURI() function is used to decode a Uniform Resource Identifier (URI) previously created by encodeURI().
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
6
7try {
8 console.log(decodeURI(encoded)); // "https://mozilla.org/?x=ัะตะปะปั"
9} catch (e) {
10 // catches a malformed URI
11 console.error(e);
12}Advertisement
Responsive Ad
๐ฏ Practice NowRelated Challenge
JavaScript Coding Exercise 42
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
212of476