Deprecated and obsolete features
This page lists features of JavaScript that are deprecated (that is, still available but planned for removal) and obsolete (that is, no longer usable).
Deprecated features
These deprecated features can still be used, but should be used with caution because they are expected to be removed entirely sometime in the future. You should work to remove their use from your code.
RegExp properties
The following properties are deprecated. This does not affect their use in replacement strings:
| СвойÑÑво | ÐпиÑание |
|---|---|
$1-$9 |
Parenthesized substring matches, if any. Warning: Using these properties can result in problems, since browser extensions can modify them. Avoid them! |
$_ |
СмоÑÑиÑе input. |
$* |
СмоÑÑиÑе multiline. |
$& |
СмоÑÑиÑе lastMatch. |
$+ |
СмоÑÑиÑе lastParen. |
$` |
СмоÑÑиÑе leftContext. |
$' |
СмоÑÑиÑе rightContext. |
input |
The string against which a regular expression is matched. |
lastMatch |
The last matched characters. |
lastParen |
The last parenthesized substring match, if any. |
leftContext |
The substring preceding the most recent match. |
rightContext |
The substring following the most recent match. |
The following are now properties of RegExp instances, no longer of the RegExp object:
| СвойÑÑво | ÐпиÑание |
|---|---|
global |
Whether or not to test the regular expression against all possible matches in a string, or only against the first. |
ignoreCase |
Whether or not to ignore case while attempting a match in a string. |
lastIndex |
The index at which to start the next match. |
multiline |
Whether or not to search in strings across multiple lines. |
source |
The text of the pattern. |
RegExp methods
- The
compile()method is deprecated. - The
valueOfmethod is no longer specialized forRegExp. UseObject.valueOf().
Function properties
Legacy generator
Legacy generator function statementandLegacy generator function expressionare deprecated. Usefunction* statementandfunction* expressioninstead.JS1.7/JS1.8 Array comprehensionandJS1.7/JS1.8 Generator comprehensionare deprecated.
Iterator
StopIterationÑÑÑаÑел.IteratorÑÑÑаÑел.
Object methods
ÐеÑÐ¾Ð´Ñ Ð´Ð°ÑÑ
getYearиsetYearare affected by the Year-2000-Problem and have been subsumed bygetFullYearиsetFullYear.- You should use
toISOStringinstead of the deprecatedtoGMTStringmethod in new code. toLocaleFormatis deprecated.
Functions
- Expression closures are deprecated. Use regular
functionsor arrow functions instead.
Proxy
- Proxy.create and Proxy.createFunction are deprecated. Use
Proxyinstead. - The following traps are obsolete:
hasOwn(Firefox bug 980565, Firefox 33).getEnumerablePropertyKeys(Firefox bug 783829, Firefox 37)getOwnPropertyNames(Firefox bug 1007334, Firefox 33)keys(Firefox bug 1007334, Firefox 33)
Escape sequences
- Octal escape sequences (\ followed by one, two, or three octal digits) are deprecated in string and regular expression literals.
- The
escapeandunescapefunctions are deprecated. UseencodeURI,encodeURIComponent,decodeURIordecodeURIComponentto encode and decode escape sequences for special characters.
ÐеÑÐ¾Ð´Ñ ÑÑÑок
- HTML wrapper methods like
String.prototype.fontsizeandString.prototype.big. String.prototype.quoteis removed from Firefox 37.- non standard
flagsparameter inString.prototype.search,String.prototype.match, andString.prototype.replaceare deprecated. String.prototype.substrprobably won't be removed anytime soon, but it's defined in Annex B of the ECMA-262 standard, whose introduction states: "⦠Programmers should not use or assume the existence of these features and behaviours when writing new ECMAScript code. â¦"
Obsolete features
These obsolete features have been entirely removed from JavaScript and can no longer be used as of the indicated version of JavaScript.
ÐбÑекÑ
| СвойÑÑво | ÐпиÑание |
|---|---|
**count** |
Returns the number of enumerable properties directly on a user-defined object. |
**parent** |
Points to an object's context. |
Object.prototype.eval() |
Evaluates a string of JavaScript code in the context of the specified object. |
Object.observe() |
Asynchronously observing the changes to an object. |
Object.unobserve() |
Remove observers. |
Object.getNotifier() |
Creates an object that allows to synthetically trigger a change. |
Function
| СвойÑÑво | ÐпиÑание |
|---|---|
arity |
Number of formal arguments. |
ÐаÑÑив
| СвойÑÑво | ÐпиÑание |
|---|---|
Array.observe() |
ÐÑÐ¸Ð½Ñ ÑоннÑй пÑоÑмоÑÑ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ð¹ в маÑÑÐ¸Ð²Ð°Ñ . |
Array.unobserve() |
Remove observers. |
ЧиÑло
ParallelArray
Statements
for each...inis deprecated. Usefor...ofinstead.- Destructuring
for...inis deprecated. Usefor...ofinstead. - let blocks and let expressions are obsolete.
E4X
СмоÑÑиÑе E4X.
Sharp variables
СмоÑÑиÑе Sharp variables in JavaScript.