Keywords and reserved words in Javascript, javascript keywords

Source: Internet
Author: User

Keywords and reserved words in Javascript, javascript keywords

A ECMA-262 describes a set of keywords that have a specific purpose and can be used to indicate the beginning or end of a control statement, or to execute a specific action. Note: keywords are reserved by language and cannot be used as identifiers.

All Keywords of ECMAScript (* added for version 5 ):

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

All reserved words in ECMA-262 (Third edition ):

Abstract enum int short boolean export interface static byte extends long super char final native class

Synchronized float package throws const goto private transient debugger implements protected volatile double

Import public

Reserved Words may be used as keywords for the next version. For example, the new debugger in the fifth version is the reserved word in the third version.

Reserved Words in non-strict mode in the fifth edition:

Class enum extends supper const export import

Reserved Words in strict mode:

Implements package public interface private static let protected yield

Note: let and yield are reserved words. We recommend that you use reserved words as references to ensure compatibility.

If you use keywords and reserved words in Javascript, an error is returned. Not recommended!


The following are not javascript keywords: () A with B parent C class D void

JScript 8.0
JScript reserved words (JScript)

JScript has many reserved words which have specific meanings in the JScript syntax. Therefore, these words cannot be used as the names of functions, variables, or constants in the script. There are a total of three types of reserved words.

Protected Reserved Words
Protected reserved words cannot be used as identifiers. Using Protected reserved words as identifiers will cause compilation errors when a script is loaded.

Break
Case
Catch
Class
Const

Continue
Debugger
Default
Delete
Do

Else
Export
Extends
False
Finally

For
Function
If
Import
In
Instanceof
New
Null
Protected
Return

Super
Switch
This
Throw
True
Try
Typeof
Var
While
With
Note:
Although "export" is a protected reserved word, it has no implementation method.
New Reserved Words
JScript also has a series of new reserved words. Like protected reserved words, these keywords have special significance in the current version of JScript. Due to backward compatibility, new reserved words can be used as identifiers. Once a new reserved word is used as an identifier, it loses its meaning as a keyword in the script. Using new reserved words as identifiers can cause confusion and should be avoided.
Abstract
Boolean
Byte
Char
Decimal
Double
Enum
Final
Float
Get
Implements
Int
Interface
Internal
Long
Package
Private
Protected
Public
Sbyte

Set
Short
Static
Uint
Ulong

Ushort
Void
Future Reserved Words
JScript has a series of future reserved words that are recommended to be used as keywords in future extensions of JScript. Like New reserved words, these reserved words can also be used as identifiers in the current version of JScript. However, to avoid using these words, it is more convenient to update the script to take advantage of the functions in future versions of JScript.
When selecting an identifier, it is important to avoid selecting the internal JScript object or function name (such as String or parseInt.
Assert
Ensure
Event
Goto
Invariant
Namespace
Native
Require
Synchronized
Throws
Transient
Use
Volatile
From "JScript 8.0 Language Reference Manual. chm ."
That is, you should select B... the remaining full text>
 
Explanation: Can Javascript in html files use keywords and reserved words as variable names?

Width, in, var, class, namespace, extense .........

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.