- OBJECTS
- Basics
- Reference
- Methods
- Constructor
- FUNDAMENTALS
- Hello World
- Code Structure
-
Use Strict
- Variables
- Data Types
- Type Conversions
- Maths
- Comparitions
- Conditional
- Loops
- Functions
- TESTING
- Mocha
- Nested Describe
- TYPES
- Primitives
- Numbers
- Strings
- Arrays
- Json
- DESIGN PATTERN
- Observer Pattern
- CLASSES
- Constructor
- Binding
- Inheritance
Strict
To keep the old code working, modern modifications are off by default.
/**
* Modern modifications are off by default,
* to keep the old code working
*
* When 'use script' it is located at the top of a script,
* the whole script works the “modern” way
* starting with ECMAScript 5
* .
*/
"use strict";
let a = 1; // Correct
b = 1; // ReferenceError: b is not defined
Questions and answers
Enable modern js features
- a) declare(strict_types=1);
- b) 'use strict';
In classes and modules 'use script'
- a) is enabled by default
- b) can't be used