Javascript 包关键字有什么用?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6167418/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 19:43:20  来源:igfitidea点击:

What is the Javascript Package keyword used for?

javascriptkeyword

提问by Dasaru

I was reading some online material on reserved JavaScript keywords and I came across the word package.

我正在阅读一些关于保留 JavaScript 关键字的在线材料,我偶然发现了这个词package

I couldn't find any clear online material that could explain what it is useful for.

我找不到任何明确的在线材料可以解释它的用途。

回答by alex

It is reserved, but not necessarily used (well, not at least of time of writing).

它是保留的,但不一定使用(好吧,至少在撰写本文时)。

The following are reserved as future keywords by the ECMAScript specification. They have no special functionality at present, but they might at some future time, so they cannot be used as identifiers. (Note that for the moment Mozilla reserves these keywords only in strict mode code. Most other browsers reserve these keywords in all code, whether strict or not, so their use is very much non-portable. Mozilla will likely reserve these keywords in normal code in a future release, to conform to the specification and to be consistent with other browsers).

以下内容被 ECMAScript 规范保留为未来的关键字。它们目前没有特殊功能,但将来可能会出现,因此它们不能用作标识符。(请注意,目前 Mozilla 仅在严格模式代码中保留这些关键字。大多数其他浏览器在所有代码中都保留这些关键字,无论是否严格,因此它们的使用非常不可移植。Mozilla 可能会在正常代码中保留这些关键字在未来的版本中,以符合规范并与其他浏览器保持一致)。

Source.

来源

回答by MacMac

The following are reserved as future keywords by the ECMAScript specification when they are found in strict mode code, except that let and yield have their traditional Mozilla-specific functionality in code compiled as JavaScript 1.7 or greater:

  • implements
  • interface
  • let
  • package
  • private
  • protected
  • public
  • static
  • yield

当在严格模式代码中找到以下内容时,ECMAScript 规范将它们保留为未来的关键字,除了 let 和 yield 在编译为 JavaScript 1.7 或更高版本的代码中具有传统的 Mozilla 特定功能:

  • 工具
  • 界面
  • 包裹
  • 私人的
  • 受保护
  • 上市
  • 静止的
  • 屈服

More information from MDC: https://developer.mozilla.org/en/JavaScript/Reference/Reserved_Words

来自 MDC 的更多信息:https: //developer.mozilla.org/en/JavaScript/Reference/Reserved_Words