Esta tradução está incompleta. Ajude atraduzir este artigo.
Esta página lista features do JavaScript que são depreciadas (ou seja, continuam disponíveis mas estão planejadas para remoção) e obsoletas (ou seja, não estão mais disponíveis).
Features depreciadas
Estas features depreciadas continuam podendo ser usadas, mas devem ser usadas com cautela porquê é esperado que sejam removidas completamente no futuro. Você deve trabalhar para remover elas do seu codigo.
Propriedades RegExp
As propriedades a seguir são depreciadas. Isto não afeta o uso delas em replacement strings:
| Propriedade | Descrição |
|---|---|
$1-$9 |
Parenthesized substring matches, if any. |
$_ |
Ver input. |
$* |
Ver multiline. |
$& |
Ver lastMatch. |
$+ |
Ver lastParen. |
$` |
Ver leftContext. |
$' |
Ver rightContext. |
input |
A string a qual a expressão regular foi encontrada. |
lastMatch |
Os ultimos caracteres encontrados. |
lastParen |
A ultima substring entre parenteses encontrada, se houver alguma. |
leftContext |
A substring antes da mais recente encontrada. |
rightContext |
A substring a seguir da mais recente encontrada. |
As propriedades a seguir são de instancia de RegExp, não mais do objeto RegExp:
| Propriedades | Descrição |
|---|---|
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
- The
callerandargumentsproperties are deprecated, because they leak the function caller. Instead of the arguments property, you should use theargumentsobject inside function closures.
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
StopIterationis deprecated.Iteratoris deprecated.
Object methods
watchandunwatchare deprecated. UseProxyinstead.__iterator__is deprecated.__noSuchMethod__is deprecated. UseProxyinstead.
Date methods
getYearandsetYearare affected by the Year-2000-Problem and have been subsumed bygetFullYearandsetFullYear.- 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(bug 980565, Firefox 33).getEnumerablePropertyKeys(bug 783829, Firefox 37)getOwnPropertyNames(bug 1007334, Firefox 33)keys(bug 1007334, Firefox 33)
let
let blocksandlet expressionsare deprecated.
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.
String methods
- 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.
Obsolete features
These obsolete features have been entirely removed from JavaScript and can no longer be used as of the indicated version of JavaScript.
Object
| Property | Description |
|---|---|
__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
| Property | Description |
|---|---|
arity |
Number of formal arguments. |
Array
| Property | Description |
Array.observe() |
Asynchronously observing changes to Arrays. |
Array.unobserve() |
Remove observers. |
Number
ParallelArray
Statements
for each...inis deprecated. Usefor...ofinstead.- Destructuring
for...inis deprecated. Usefor...ofinstead.
E4X
See E4X for more information.
Sharp variables
See Sharp variables in JavaScript for more information.