Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Reserved keywords in JavaScript | JavaScript syntax
Introduction to JavaScript (staging)
course content

Course Content

Introduction to JavaScript (staging)

Introduction to JavaScript (staging)

1. Introduction
2. JavaScript syntax
3. Data Types and Variables

book
Reserved keywords in JavaScript

What are keywords

JavaScript uses many identifiers as the keywords for language to give power to the language itself. We should avoid using keywords as identifiers for our programs.

Following is the link to a list of some commonly used keywords All Reserved Keywords in JavaScript:

Note: Those keywords are for a specific purpose and perform a specific task that empowers the language itself.

ECMAScript 5 reserved keywords

Some keywords are not used by the language but also reserved. We should avoid them. They will be used in the next versions ECMAScript5 reserves the following words:

class, const, enum, export, extends, import, and super.

Following are some legal ordinary JavaScript words but they are reserved in strict mode: implements, let, private, public, yield, interface, package, protected, and static.

Note: This strict context forbids particular actions from being taken and sends more exceptions. The statement “use strict”; guide the browser to use the Strict mode, which is a reduced and safer feature set of JavaScript.

Task
test

Swipe to show code editor

Your task is to replace the above problematic variables with some legal names.

Best Practises

We should avoid the use of predefined several global variables and functions names for identifier name. Note: There are brief lectures regarding global variables and functions.

Summary:

  • Keywords should not be used for identifiers.
  • Keyword is of specific purpose do not use them for variables name.
  • We should also take care of the ECMAScript 5 reserved keywords while naming our variables.
  • It is best practice to use a strict mode.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 6
toggle bottom row

book
Reserved keywords in JavaScript

What are keywords

JavaScript uses many identifiers as the keywords for language to give power to the language itself. We should avoid using keywords as identifiers for our programs.

Following is the link to a list of some commonly used keywords All Reserved Keywords in JavaScript:

Note: Those keywords are for a specific purpose and perform a specific task that empowers the language itself.

ECMAScript 5 reserved keywords

Some keywords are not used by the language but also reserved. We should avoid them. They will be used in the next versions ECMAScript5 reserves the following words:

class, const, enum, export, extends, import, and super.

Following are some legal ordinary JavaScript words but they are reserved in strict mode: implements, let, private, public, yield, interface, package, protected, and static.

Note: This strict context forbids particular actions from being taken and sends more exceptions. The statement “use strict”; guide the browser to use the Strict mode, which is a reduced and safer feature set of JavaScript.

Task
test

Swipe to show code editor

Your task is to replace the above problematic variables with some legal names.

Best Practises

We should avoid the use of predefined several global variables and functions names for identifier name. Note: There are brief lectures regarding global variables and functions.

Summary:

  • Keywords should not be used for identifiers.
  • Keyword is of specific purpose do not use them for variables name.
  • We should also take care of the ECMAScript 5 reserved keywords while naming our variables.
  • It is best practice to use a strict mode.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 6
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt