Deprecated and obsolete features - JavaScript 编辑

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:

PropertyDescription
$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.
inputThe string against which a regular expression is matched.
lastMatchThe last matched characters.
lastParenThe last parenthesized substring match, if any.
leftContextThe substring preceding the most recent match.
rightContextThe substring following the most recent match.

The following are now properties of RegExp instances, no longer of the RegExp object:

PropertyDescription
globalWhether or not to test the regular expression against all possible matches in a string, or only against the first.
ignoreCaseWhether or not to ignore case while attempting a match in a string.
lastIndexThe index at which to start the next match.
multilineWhether or not to search in strings across multiple lines.
sourceThe text of the pattern.

RegExp methods

Function properties

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

Legacy generator

Iterator

Object methods

Date methods

Functions

Proxy

Escape sequences

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

PropertyDescription
__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

PropertyDescription
arityNumber of formal arguments.

Array

PropertyDescription
Array.observe()Asynchronously observing changes to Arrays.
Array.unobserve()Remove observers.

Number

ParallelArray

Statements

E4X

See E4X for more information.

Sharp variables

See Sharp variables in JavaScript for more information.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:135 次

字数:19899

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文