011_Strict keyword -must known
- Example: In normal JavaScript, mistyping a variable name creates a new global variable. In strict mode, this will throw an error, making it impossible to accidentally create a global variable

- Example: Using strict mode, don’t allow to use a variable without declaring it.
- Output:

- Example: Deleting a variable (or object) and a function is not allowed
- Output:

- Example: Duplicating a parameter name is not allowed.
- Output:

- Example: Octal numeric literals are not allowed.
- Output:

- Example: Escape characters are not allowed.
- Output:

- Example: Writing to a read-only property is not allowed.
- Output:

- Example: Writing to a get-only property is not allowed.
- Output:

- Example: Deleting an undeletable property is not allowed.
- Output:

- Example: The string “eval” cannot be used as a variable.
- Output:

- Example: The string “arguments” cannot be used as a variable.
- Output:

- Example: The with statement is not allowed.
- Output:

Note: In function calls like f(), this value was the global object. In strict mode, it is now undefined. In normal JavaScript, a developer will not receive any error feedback assigning values to non-writable properties.
Comments
Post a Comment