Definition and Usage The unescape() function decodes a string encoded with escape(). Syntax unescape(string) Parameter ...
Definition and Usage
The unescape() function decodes a string encoded with escape().
Syntax
Parameter | Description |
string | Required. The string to be decoded |
Tips and Notes
Note: The escape() and unescape() functions should not be used to encode or decode URIs. Use encodeURI() and decodeURI() functions instead!
Example
In this example we first encode the strings with the escape() function, and then decode them with the unescape() function:
<script type="text/javascript"> var test1="Visit google!"; test1=escape(test1);
document.write (test1 + "<br />"); test1=unescape(test1);
document.write(test1 + "<br />"); </script> |
The output of the code above will be:
Visit%20google%21
Visit google! |