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

What are the reserved words in javascript

青灯夜游
青灯夜游Original
2021-09-03 17:08:154619browse

In JavaScript, reserved words are a set of names (or commands) prepared for use within the JavaScript language stipulated in ECMA-262. They cannot be used as variables, function names, object names, etc. Reserved words are reserved for JavaScript upgrades and users are advised not to use them.

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

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

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

ECMAScript 3 lists all Java keywords as reserved words, while ECMAScript 5 has more flexible regulations.

For example, 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 Be more cautious and strictly limit the use of implements, interface, let, package, private, protected, public, static, yield, eval (non-reserved words), and arguments (non-reserved words).

Note:

Whether in strict mode or non-strict mode, do not use it when defining variable names, function names or attribute names The reserved words listed above prevent students from falling into the trap.

[Recommended learning: javascript advanced 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