Home  >  Article  >  Web Front-end  >  What are the reserved words in JavaScript?

What are the reserved words in JavaScript?

青灯夜游
青灯夜游Original
2021-12-07 13:58:0011791browse

The reserved words of JavaScript are: abstract, double, goto, native, static, boolean, enum, implements, package, super, byte, char, class, const, public, etc.

What are the reserved words in JavaScript?

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

Reserved words of JavaScript

Reserved words are a set of names (or commands) prepared for use within the JavaScript language. These names currently have no specific purpose and are reserved for JavaScript upgrades. Users are advised not to use them. Specific instructions are shown in the table.

##booleanenumimplementspackagesuperbyteexportimportprivatesynchronizedcharextendsintprotectedthrowsclassfinalinterfacepublictransientconst#floatlong shortvolatile##ECMAScript 3 lists all Java keywords as reserved words, while ECMAScript 5 has more flexible regulations, for example:
JavaScript Reserved Words
abstract double goto native static

    In non-strict mode, only class, const, enums, export, extends, import, and super are reserved words, and other ECMAScript 3 reserved words can be used freely;
  • In strict mode, ECMAScript 5 becomes more cautious and strictly limits the use of implements, interface, let, package, private, protected, public, static, yield, eval (non-reserved words), arguments (non-reserved words) .
  • JavaScript predefines many global variables and functions, and users should avoid using them. The specific instructions are as shown in the table.

JavaScript predefined global variables and functionsarguments ##Array encodeURLComponent isFinite Object StringBoolean Error isNaN parseFloat SyntaxErrorDate eval JSON parseInt TypeErrordecodeURL EvalError Math RangeError undefinedFunction Different JavaScript running environments will predefine some global variables and functions. The only ones listed in the above table are Targeted at web browser operating environment.
encodeURL Infinity Number RegExp
##decodeURLComponent
NaN ReferenceError URLError
Whether in strict mode or non-strict mode, do not use the reserved words listed above when defining variable names, function names, or attribute names.

[Related recommendations:
javascript learning tutorial

]

The above is the detailed content of What are the reserved words in JavaScript?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn