Prerequisite: JavaScript | escape()
The unescape() function in JavaScript takes a string as a parameter and use to decode that string encoded by the escape() function. The hexadecimal sequence in the string is replaced by the characters they represent when decoded via unescape().
Syntax :
unescape(string)
<script> // Special character encoded with // escape function var str = escape( "Geeks for Geeks!!!" ); document.write( "Encoded : " + str); // New Line document.write( "<br>" ); // unescape() function document.write( "Decoded : " + unescape(str)) // New Line document.write( "<br><br>" ); // The exception // @ and . not encoded. str = escape( "To contribute articles contact us" + document.write( "Encoded : " + str); // New Line document.write( "<br>" ); // unescape() function document.write( "Decoded : " + unescape(str)) </script> |
Output :
Encoded : Geeks%20for%20Geeks%21%21%21 Decoded : Geeks for Geeks!!! Encoded : To%20contribute%20articles%20contact%20us%20at%[email protected] Decoded : To contribute articles contact us at [email protected]
leave a comment
0 Comments