Is int a JavaScript reserved word?

青灯夜游
Release: 2023-01-11 09:19:02
Original
2250 people have browsed it

int is a reserved word in JavaScript. JavaScript contains multiple reserved words: abstract, enum, int, short, boolean, export, interface, static, byte, extends, long, super, etc.

Is int a JavaScript reserved word?

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

Reserved wordsare 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:

Using keywords as identifiers in code will cause an "Identifier Expected" (missing identifier) error in most browsers. Using reserved words may not cause the same error, depending on the browser. In general, it is best not to use keywords and reserved words as identifiers to maintain compatibility with future versions of ECMAScript.

[Recommended learning:javascript advanced tutorial]

The above is the detailed content of Is int a JavaScript reserved word?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!