Skip to content

JavaScript unescape string | Example code

  • by

Use unescape() function in JavaScript to decode given string. This string may be encoded by the escape() function.

unescape(string)

Note: Do not use unescape to decode URIs, use decodeURI instead.

Example unescape string in JavaScript

HTML example code, This function accepts a single parameter.

<!DOCTYPE html>
<html>
<body>

  <script>

   str = escape("Hellow tutorial.eyehunts.com")
   document.write("Encoded : " + str);
   
   // New Line
   document.write("<br>");
   
   // unescape() function
   document.write("Decoded : " + unescape(str))
   
 </script>
</body>
</html>

Output:

JavaScript unescape string

Warning: Although unescape() is not strictly deprecated (as in “removed from the Web standards”), it is defined in Annex B of the ECMA-262 standard, whose introduction states:

Do comment if you have any doubts or suggestions on this JS escape code.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading