Deprecated and obsolete features
… 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. …
Some others, albeit in the main spec body, are also marked as normative optional and should not be depended on.
<!-- comment console.log("a"); <!-- another comment console.log("b"); --> More comment // Logs "a" and "b"
--> both act like
//, i.e. starting line comments.
--> is only valid at the start of a line (to avoid ambiguity with a postfix decrement followed by a greater than operator), while
<!-- can occur anywhere in the line.
The following properties are deprecated. This does not affect their use in replacement strings:
Parenthesized substring matches, if any.
The string against which a regular expression is matched.
The last matched substring.
The last parenthesized substring match, if any.
The substring preceding the most recent match.
The substring following the most recent match.
Warning: Avoid using these static properties, as they can cause issues when interacting with external code!
compile() method is deprecated. Construct a new
RegExp instance instead.
Object.prototype.__proto__accessors are deprecated. Use
Object.setPrototypeOfinstead. This does not apply to the
__proto__literal key in object literals.
Object.prototype.__lookupSetter__methods are deprecated. Use
- HTML wrapper methods like
String.prototype.substrprobably won't be removed anytime soon, but it's defined in Annex B and hence normative optional.
String.prototype.trimRightshould be replaced with
- Octal escape sequences (\ followed by one, two, or three octal digits) are deprecated in string and regular expression literals.
unescapefunctions are deprecated. Use
decodeURIComponentto encode and decode escape sequences for special characters.
The following are now properties of
RegExp instances, no longer of the
||Whether or not to test the regular expression against all possible matches in a string, or only against the first.|
||Whether or not to ignore case while attempting a match in a string.|
||The index at which to start the next match.|
||Whether or not to search in strings across multiple lines.|
||The text of the pattern.|
valueOf() method is no longer specialized for
RegExp. It uses
Object.prototype.valueOf(), which returns itself.
arityproperty is obsolete. Use
||Returns the number of enumerable properties directly on a user-defined object.||
||Points to an object's context.||No direct replacement|
||Used with legacy iterators.||
||A method called when a non-existent property is called as method.||
||Asynchronously observing the changes to an object.||
||Create a notifier object that allows to synthetically trigger a change observable with
||No direct replacement|
||Attach a handler callback to a property that gets called when the property is assigned.||
||Remove watch handlers on a property.||
- Non-standard String generic methods like
String.slice(myStr, 0, 12),
String.prototype.quoteis removed from Firefox 37.
WeakMap.prototype.clear()was added in Firefox 20 and removed in Firefox 46. It is not possible to traverse all keys in a
toSource() methods of arrays, numbers, strings, etc. and the
uneval() global function are obsolete. Use
toString(), or write your own serialization method instead.
Legacy generator function statements and legacy generator function expressions are removed. The legacy generator function syntax reuses the
function keyword, which automatically becomes a generator function when there are one or more
yield expressions in the body — this is now a syntax error. Use
function* statements and
function* expressions instead.
Array comprehensions and generator comprehensions are removed.
// Legacy array comprehensions [for (x of iterable) x] [for (x of iterable) if (condition) x] [for (x of iterable) for (y of iterable) x + y] // Legacy generator comprehensions (for (x of iterable) x) (for (x of iterable) if (condition) x) (for (x of iterable) for (y of iterable) x + y)
Firefox, prior to version 26, implemented another iterator protocol that is similar to the standard Iterator protocol. An object is an legacy iterator when it implements a
next() method, which produces a value on each call and throws a
StopIteration object at the end of iteration. This legacy iterator protocol differs from the standard iterator protocol:
- The value was returned directly as the return value of calls to
next(), instead of the
valueproperty of the
- Iteration termination was expressed by throwing a
StopIterationobject, instead of through the
doneproperty of the
Sharp variables are obsolete. To create circular structures, use temporary variables instead.