escape() 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. …
escape() function computes a
new string in which certain characters have been replaced by a hexadecimal escape
Note: This function was used mostly for URL queries (the part of a
?)—not for escaping ordinary String literals,
which use the format "
two hexadecimal digits, and the form
used for higher-plane Unicode characters.)
Escaped characters in String literals can be expanded by replacing the
%, then using the
- A string to be encoded.
A new string in which certain characters have been escaped.
escape function is a property of the global object. Special
characters are encoded with the exception of:
The hexadecimal form for characters, whose code unit value is
less, is a two-digit escape sequence:
%xx. For characters with a
greater code unit, the four-digit format
escape('abc123'); // "abc123" escape('äöü'); // "%E4%F6%FC" escape('ć'); // "%u0107" // special characters escape('@*_+-./'); // "@*_+-./"
|ECMAScript Language Specification (ECMAScript)|
BCD tables only load in the browser