Deprecated and obsolete features Redirect 1

This appendix 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:

Property Description
$1, ..., $9

Parenthesized substring matches, if any.
Warning: Using these properties can result in problems, since browser extensions can modify them. Avoid them!

$_ See input.
$* See multiline.
$& See lastMatch.
$+ See lastParen.
$` See leftContext.
$' See 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:

Property Description
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 valueOf method is no longer specialized for RegExp. Use Object.valueOf.

Function properties

  • The caller and arguments property are deprecated, because they leak the function caller. Instead of the arguments property, you should use the arguments object inside function closures.

Date methods

  • getYear and setYear are affected by the Year-2000-Problem and have been subsumed by getFullYear and setFullYear.
  • You should use toISOString instead of the deprecated¬† toGMTString method in new code.

Escape sequences

  • Octal escape sequences (\ followed by one, two, or three octal digits) are deprecated in string and regular expression literals.
  • The escape and unescape functions are deprecated. Use encodeURI, encodeURIComponent, decodeURI or decodeURIComponent to encode and decode escape sequences for special characters.

String methods

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.
Method Description
eval Evaluates a string of JavaScript code in the context of the specified object.

Function

Property Description
arity Number of formal arguments.

 

Document Tags and Contributors

 Last updated by: Sheppy,