Get the App
SLTechnology News&Howtos  ›  Development  › 

Is int a reserved word for JavaScript?

Shulou Source: shulou.com Published: 2022-06-03 16:31:20 10月04日 Update

int is not JavaScript reserved words, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this can learn, I hope you can gain something.

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

Operating environment of this tutorial: Windows 7 system, Javascript version 1.8.5, Dell G3 computer.

A reserved word is a group of names (or commands) that are intended for use within the JavaScript language as specified in ECMA-262. These names have no specific purpose at present, they are reserved for JavaScript upgrade versions, and users are advised not to use them. Details are shown in the table.

ECMAScript reserved words abstractdoublegotonativestaticbooleannumimplementspackagessupbyteexportimportprivatesynchronizedcharextendsintprotectedthrowsclassfinalinterfacepubliclicentransientconstfloatlongshortvolatile

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

For example, in non-strict mode, only class, const, enumerates, export, extends, import, and super are reserved words, and other ECMAScript 3 reserved words are freely used; in strict mode, ECMAScript 5 becomes more cautious and strictly restricts the use of implements, interfaces, lets, packages, private, protected, public, static, yield, eval (non-reserved words), and arguments (non-reserved words).

Using keywords as identifiers in your code causes an "Identifier Expected" error in most browsers. Depending on the browser, using reserved words may not result in the same error. In general, it is best not to use keywords and reserved words as identifiers, and to keep compatibility with future versions of ECMAScript.

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to the industry information channel, thank you for your support.

Tags: Keywords keywords identifiers identifiers names patterns browsers versions errors help browsing clarity freedom generally speaking code but content commands multiple for this Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Docker Shulou Tech Info Apple NVidia