JavaScript unescape() Function
JavaScript Global Functions
Definition and Usage
The unescape() function decodes a string that was encoded with escape().
Tip: Using the functionescape() Encodes a string.
**Note:** The unescape() function has been removed from the Web standard, so it should be avoided; you can use decodeURI or decodeURIComponent instead.
Syntax
unescape(string)
| Parameters | Description |
|---|---|
| string | Required. The string to decode. |
Browser support





All major browsers support the unescape() function.
Tips and Notes
Note: unescape() cannot be used to decode a URI (Uniform Resource Identifier, abbreviated "URI"). To decode a URI, use decodeURI() method.
Example
Example
In this example, we use escape() to encode a string, then use unescape() to decode it:
var
str
=
"
Need tips? Visit RUNOOB!
"
;
var
str_esc
=
escape
(
str
)
;
document
.
write
(
str_esc
"
"
)
document
.
write
(
unescape
(
str_esc
)
)
Try it »
JavaScript Global Functions