Keywords and reserved words in Javascript

Source: Internet
Author: User
A complete JavaScript implementation consists of the following three different parts: the core (ECMAScript), the Document Object Model (DOM), and the browser Object Model (BOM ). The ECMA-262 describes a group

A complete JavaScript implementation consists of the following three different parts: the core (ECMAScript), the Document Object Model (DOM), and the browser Object Model (BOM ). The ECMA-262 describes a set of keywords that have a specific purpose, which can be used to indicate the beginning or end of a control statement, or to execute a specific operation. According to the rules, keywords are reserved by language and cannot be used as identifiers. The following are all the keywords of ECMAScript (that is, Javascript) (the keywords added in version 5th with the * sign ):

Break

Do

Instanceof

Typeof

Case

Else

New

Var

Catch

Finally

Return

Void

Continue

For

Switch

While

Debugger *

Function

This

With

Default

If

Throw

Delete

In

Try



The ECMA-262 also describes another group of reserved words that cannot be used as identifiers. Although reserved words do not have any specific purpose in this language, they may be used as keywords in the future. The following are all reserved words defined by ECMA-262 version 3rd (reserved words added by version 5th with the * sign ):

Abstract

Enum

Int

Short

Boolean

Export

Interface

Static

Byte

Extends

Long

Super

Char

Final

Native

Synchronized

Class

Float

Package

Throws

Const

Goto

Private

Transient

Debugger

Implements

Protected

Volatile

Double

Import

Public

Let *

Yield *




In addition to the keywords and reserved words listed above, ECMA-262 version 5th imposes limits on evel and arguments, and in strict mode neither can be used as an identifier or attribute name, otherwise an error is thrown.

The above are all the keywords and reserved words of Javascript. Whether it's a strict mode or not, whether it's for ECMA-262 3rd or 5th, to ensure maximum compatibility and code "security ", the keywords and reserved words mentioned above are not used as identifiers, attribute names, and function names during actual development.


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.