The unescape()
function was deprecated in JavaScript version 1.5.
Use decodeURI() or decodeURIComponent() instead.
unescape |
Yes | Yes | Yes | Yes | Yes |
var v = unescape(string)
Parameter | Description |
---|---|
string | Required. The string to be decoded |
A String type value representing the decoded string.
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: