JavaScript保留字和预定义的全局变量及函数汇总

83 阅读1分钟

保留字也称关键字,每种语言中都有该语言本身规定的一些关键字,这些关键字都是该语言的语法实现基础,JavaScript中规定了一些标识符作为现行版本的关键字或者将来版本中可能会用到的关键字,所以当我们定义标识符时就不能使用这些关键字了,下面介绍下JavaScript保留字和预定义的全局变量及函数汇总

13e796fd8a9743b8889bfb6799a0a4d1.png

一、官方保留字

ifelsebreakdeletetrue
switchcasecatchnewfalse
forincontinuenullfunction
dowhilefinallyreturninstanceof
trywiththrowthistypeof
varvoiddebuggerdefault

二、ES5保留字

letyieldargumentsstaticimport
constinterfaceimplementspublicexport
classevalpackageprivateprotected
superenum

三、JavaScript预定义的全局变量和函数关键字

ArgumentsArrayErrorInfinityparseFloat
encodeURIBooleanEvalErrorisFiniteparseInt
encodeURIComponentDateRangeErrorisNaNRegExp
decodeURIFunctionReferenceErrorNaNString
decodeURIComponentNumberTypeErrorJSONMath
evalObjectURIErrorSyntaxErrorundefined