unescape()
Warning: Although unescape() is not strictly deprecated
(as in "removed from the Web standards"), it is defined in
Annex B
of the ECMA-262 standard, whose introduction states:
… All of the language features and behaviors specified in this annex have one or more undesirable characteristics and in the absence of legacy usage would be removed from this specification. … … Programmers should not use or assume the existence of these features and behaviors when writing new ECMAScript code. …
The unescape() function computes a new string in which
hexadecimal escape sequences are replaced with the character that it represents. The
escape sequences might be introduced by a function like escape. Usually,
decodeURI or decodeURIComponent are preferred over
unescape.
Note: Do not use unescape to decode URIs,
use decodeURI instead.
Syntax
unescape(str)
Parameters
str-
A string to be decoded.
Return value
A new string in which certain characters have been unescaped.
Description
The unescape function is a property of the global object.
Examples
Using unescape
unescape('abc123'); // "abc123"
unescape('%E4%F6%FC'); // "äöü"
unescape('%u0107'); // "ć"
Specifications
| Specification |
|---|
| ECMAScript Language Specification # sec-unescape-string |
Browser compatibility
BCD tables only load in the browser