Javascript Reference - JavaScript unescape() Function








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

Browser Support

unescape Yes Yes Yes Yes Yes

Syntax

var v = unescape(string)

Parameter Values

Parameter Description
string Required. The string to be decoded




Return Value

A String type value representing the decoded string.

Example

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


<!DOCTYPE html>
<html>
<body>
<!--from  w w  w  .  ja v a 2  s  . c o m-->
<script>
    var str="abc";
    var str_esc=escape(str);
    document.write(str_esc + "<br>")
    document.write(unescape(str_esc))

</script>

</body>
</html>

The code above is rendered as follows: