JavaScript Reserved Words

摘自:《JavaScript Visual QuickStart Guide (8th Edition)》。

Reversed words are words that have special meaning to JavaScript. Therefore, they cannot be used as variable or function names.

ECMAScript Edition 3 Reserved Words

These words are part of the JavaScript language as of ES3.

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

ES3 Future Reserved Words

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

ECMAScript Edition 5 Reserved Words

This is ES5’s list of reserved words. It’s similar to that of ES3, but given that browsers primarily suppot ES3, we recommend that you keep both lists in mind.

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

ES5 Future Reserved Words

  • class
  • const
  • enum
  • export
  • extends
  • implements
  • import
  • interface
  • let
  • package
  • private
  • protected
  • public
  • static
  • super
  • yield

Oter identifiers to avoid

These (along with the object names) aren’t officially reserved, but as they are (or may be) part of the JavaScript language, you shouldn’t use them as function or variable names. If you do, abandon all hope; the results will be unpredictable.In addition, most browsers are case-sensitive, which means that they differentiate between Document and document. Internet Explorer is only sometimes case-sensitive, which means that, for example, it may not understand any difference etween Document and document. Consequently, be aware that just because it works in one browser doesn’t mean tha it’ll always work in others. Test, test, test.

  • abstract
  • arguments
  • Array
  • Boolean
  • byte
  • call
  • cast
  • char
  • Date
  • decimal
  • decodeURI
  • decodeURIComponent
  • double
  • dynamic
  • each
  • encodeURI
  • encodeURICompnent
  • Error
  • eval
  • EvalError
  • false
  • final
  • float
  • Function
  • generator
  • get
  • goto
  • has
  • include
  • Infinity
  • int
  • internal
  • intrinsic
  • is
  • isFinite
  • isNaN
  • JSON
  • like
  • long
  • Math
  • namespace
  • NaN
  • native
  • null
  • Number
  • Object
  • override
  • parseFloat
  • parseInt
  • precision
  • prototype
  • RangeError
  • ReferenceError
  • RegExp
  • rounding
  • set
  • short
  • standard
  • strict
  • String
  • synchronized
  • SyntaxError
  • throws
  • to
  • transient
  • true
  • type
  • TypeError
  • uint
  • undefined
  • URIError
  • use
  • volatile
  • xml
Author: Yakima
关于作者:楠溪江人,出生于1991年,目前坐标上海。读书时代跳过级、保过送,工作后转过行。2013年本科毕业于北药。看书、码字、敲代码、打羽毛球是我花时间的爱好。曾在某上市药企任国际药品注册岗,现在某高新企业任前端管理岗。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据