#341💼 Interview💻 Code
What are the list of cases error thrown from non-strict mode to strict mode
Advertisement
728x90
When you apply 'use strict'; syntax, some of the below cases will throw a SyntaxError before executing the script
1. When you use Octal syntax
javascript
1var n = 022;2. Using with statement
3. When you use delete operator on a variable name
4. Using eval or arguments as variable or function argument name
5. When you use newly reserved keywords
6. When you declare a function in a block and access it from outside of the block
javascript
1if (someCondition) {
2 function f() {}
3 }
4
5f(); // ReferenceError: f is not definedHence, the errors from above cases are helpful to avoid errors in development/production environments.
Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 84
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
341of476