I'm wondering when ECMAScript 6 comes, do we still need to put "use strict" in js codes?
The "use strict" Directive It is not a statement, but a literal expression, ignored by earlier versions of JavaScript. The purpose of "use strict" is to indicate that the code should be executed in "strict mode". With strict mode, you can not, for example, use undeclared variables.
Turning on strict mode helps you find errors sooner, before they become bigger problems. And it forces you to write better code. Always use strict mode on your scripts.
If you have such an unrestrictedly typed code, that is used variables without declaring. One variable declared within some function/scope and used from somewhere else(it will be undeclared there) and you can't rewrite/change them, then you should not go for "use strict;" mode because it will break the code.
Yes, unfortunately. Except in modules, where it is implied.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With