w3resource

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.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/javascript/functions/decodeURIComponent-function.php