JavaScript Use Strict

JavaScript Use Strict


JavaScript Use Strict
In this tutorial, you will learn about JavaScript ‘use Strict’:
JavaScript allows strictness of code using “use strict” introduced in ECMAScript 5, is a way to opt-in to a restricted variant of JavaScript, thereby implicitly opting-out of Sloopy mode.
JavaScript is a loosely typed (dynamic) scripting language. If you have worked with server side language like java or c#, you must be familiar with the strictness of the language. For Example, you expect the compiler to give an error if you have used a variable before defining it.
JavaScript Strict Mode – JavaScript, JavaScript…
The Syntax of the ‘use strict’ is as follows:-
‘use strict’
// Error
myvar = 9;
Example - 
  
Output
Note: Strict mode does not apply to block statements with {} braces.