It's all about
connecting the dots

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
赞(0) 打赏
版权声明:非商业用途转载请注明文章链接,商业用途转载请联系邮箱获取授权。
文章名称:《JavaScript Reserved Words》
文章链接:https://www.orzzone.com/javascript-reserved-words.html
商业联系:yakima.public@gmail.com
本站内容仅供个人学习交流,不做为任何投资、建议的参考依据,因此产生的问题需自行承担。

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏