JavaScript中的保留关键字

时间:2020-03-05 18:42:52  来源:igfitidea点击:

保留哪些JavaScript关键字(函数名称,变量等)?

解决方案

回答

我们应该链接到实际的信息来源,而不仅仅是热门的Google热门网站。

http://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Reserved_Words

JScript 8.0:
http://msdn.microsoft.com/zh-CN/library/ttyab5c8.aspx

稍后我将寻找ECMAScript链接。

回答

要补充benc的答案,请参阅标准ECMA-262. 这些是官方保留字,但只有学徒会忽略实现以尊重标准。有关最受欢迎的实现(即Firefox和Internet Explorer)的保留字,请参阅benc的答案。

EMCAScript-262中的保留字是关键字,将来的保留字,NullLiteral和BooleanLiterals,其中关键字是

break     do        instanceof  typeof
case      else      new         var
catch     finally   return      void
continue  for       switch      while
debugger  function  this        with
default   if        throw
delete    in        try

未来保留字是

abstract  export      interface  static
boolean   extends     long       super
byte      final       native     synchronized
char      float       package    throws
class     goto        private    transient
const     implements  protected  volatile
double    import      public 
enum      int         short

NullLiteral是

null

和BooleanLiterals是

true
false