JS keywords and reserved words

Source: Internet
Author: User

You cannot use keywords, reserved words, true, false, and NULL as identifiers.

The keywords in JS can be used to denote the start or end of a control statement, or to perform a specific operation. By rule, keywords are also language-reserved and cannot be used as identifiers. Here are all the keywords for ecmascription:

Break, else, New, Var, case, finally, return, void, catch, for, switch, while, continue, function, this, with, DEFA Ult, if, throw, delete, in, try, do, instranceof, typeof

The ECMA also describes another set of reserved words that cannot be used as identifiers. Although reserved words do not have any specific purpose in this language, they are likely to be used as keywords in the future. The following are all reserved words defined by ECMA version 3rd:

abstract, enum, int, short, Boolean, export, interface, static, Byte, extends, long, super, Char, final, NA tive, synchronized, class, float, package, throws, const,Goto, Private, transient, debugger, implements, p rotected, volatile, double, import, public

Using keywords as identifiers in your code will be a "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 and to remain compatible with future versions of ECMAScript.

This digest is from "JAVASCRIPTI Senior Programmer Design (2nd edition)"

JS keywords and reserved words

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.