Conteúdo do Curso
Introduction to JavaScript (staging)
Introduction to JavaScript (staging)
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.
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.
Obrigado pelo seu feedback!
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.
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.
Obrigado pelo seu feedback!