Global unescape() Function - Javascript Global

Javascript examples for Global:unescape

Description

The unescape() function was deprecated in JavaScript version 1.5. Use decodeURI() or decodeURIComponent() instead.

The unescape() function decodes an encoded string.

Parameter Values

Parameter Description
stringRequired. The string to be decoded

Return Value:

A String, representing the decoded string

The following code shows how to Encode and decode a string:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<script>

var str="~!@#$%^&*()_+ java2s.com!";
var str_esc=escape(str);/*from   ww  w  .  j  a  v  a 2s  . c  o m*/
document.write(str_esc + "<br>")
document.write(unescape(str_esc))

</script>

</body>
</html>

Related Tutorials