Loading...
Loading...
By continuing to use the platform, you accept the terms of the Privacy Policy and the use of cookies.
👋 Hi! I'm Dastan, author of Hack Frontend. Always open to professional networking => connect with me on LinkedIn.
Strict mode in JavaScript is a special operating mode that helps write safer and better quality code. By enabling it, you activate additional checks and restrictions that prevent common errors.
"use strict";
x = 10; // Error: variable not declared
"use strict";
delete x; // Error: cannot delete variable or function
this in functions. Without strict mode:function showThis() {
console.log(this); // `this` refers to global object (window in browser)
}
With strict mode:
"use strict";
function showThis() {
console.log(this); // `this` will be undefined
}
implements, interface, package cannot be used as variables or function names.