
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
What is the difference between "strict" and "non-strict" modes of JavaScript?
The “use strict” is a directive, which is a literal expression. It introduced in JavaScript 1.8.5. As the name suggests, “use strict” indicates that the code is to be executed in strict mode. Under non-strict, the code won’t execute won’t execute in strict mode.
Let us declare strict mode. To declare, add the keyword “use strict” in the beginning. For global scope, declare it at the beginning of the script.
<!DOCTYPE html> <html> <body> <p>An error would come, since you have used a variable, but forgot to declare it</p> <p>Press F8 to see the error.</p> <script> "use strict"; a = 1; </script> </body> </html>
- Related Articles
- What is Strict mode in JavaScript?
- What is Strict Mode in JavaScript and How to Enable It?
- What are the characteristics of JavaScript 'Strict Mode'?
- What does “use strict” do in JavaScript, and what is the reasoning behind it?
- Strict Liability: Definition and Meaning
- Explain Strict Comparison in JavaScript switch statement?
- Strict equality vs Loose equality in JavaScript.
- Strict Mode in ReactJS
- Why do we use "use strict" in JavaScript?
- How to secure my JavaScript using "Strict mode"?
- Why strict aliasing is required in C?
- Absolute Liability Vs Strict Liability
- Is it safe to assume strict comparison in a JavaScript switch statement?
- How do I disable Strict Mode in MySQL?
- Types of Two Phase Locking (Strict, Rigorous & Conservative) in DBMS

Advertisements