JavaScript编程
Completion requirements
在 JavaScript 中,一些词语(标记)具有特殊的语义(含义)。因此,它们不能用作变量、函数、类等的名称[1][2]。这些词语有些是通用的保留字,有些只在特定的上下文中被保留,有些是为将来的使用预留的,当前没有特殊功能,另外一些则是在过时的 ECMAScript 版本(1997-1999 年)中定义的。
以下是截至 2022 年的特殊词汇列表。对于一些词语,我们提供了进一步的信息。
保留字列表:
- abstract
- await
- boolean
- break
- byte
- case
- catch
- char
- class
- const
- continue
- debugger
- default
- delete
- do
- double
- else
- enum
- export
- extends
- false
- final
- finally
- float
- for
- function
- goto
- if
- implements
- import
- in
- instanceof
- int
- interface
- let
- long
- native
- new
- null
- package
- private
- protected
- public
- return
- short
- static
- super
- switch
- synchronized
- this
- throw
- throws
- transient
- true
- try
- typeof
- var
- void
- volatile
- while
- with
- yield
此外,还有一些预定义的方法(如 forEach()
)、预定义的模块(如 Math
)或预定义的对象(如 BigInt
),它们的名称也应该避免使用。
参考文献:
Last modified: Monday, 13 January 2025, 1:43 AM