JavaScript: decodeURIComponent functions
Description
The decodeURIComponent function is used to decode a Uniform Resource Identifier (URI) component previously created by encodeURIComponent.
Syntax
decodeURIComponent(encodedURI)
Parameters
encodedURI: An encoded component of a Uniform Resource Identifier.
Example of decodeURIComponent() function
In the following web document decodeURIComponent() function is used to decode a Uniform Resource Identifier (URI) component previously created by encodeURIComponent.
JavaScript Code:
url1 = "https://w3resource.com/xyz=http%3A%2F%2Fmyw3r.com%2Fx%3D31%26y%3D21&xyz3=45";
//Lets decode url1
console.log(decodeURIComponent(url1));
View the example in the browser
Live demo:
See the Pen decodeURIComponent-function-1 by w3resource (@w3resource) on CodePen.
Previous: JavaScript: encodeURIComponent functions
Next: JavaScript Object
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics