What is the Javascript Package keyword used for?

☆樱花仙子☆ 提交于 2020-06-10 02:31:35

问题


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

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


回答1:


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).

Source.




回答2:


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

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



来源:https://stackoverflow.com/questions/6167418/what-is-the-javascript-package-keyword-used-for

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!