Latest

recent

JavaScript unescape() Function

Definition and Usage

The unescape() function decodes a string encoded with escape().

Syntax

unescape(string)

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!
JavaScript unescape() Function Reviewed by 1000sourcecodes on 03:26 Rating: 5
Powered by Blogger.