Strict Mode in Javascript works in frameworks?

Asked

Viewed 54 times

2

I am studying Javascript and came across Strict Mode (use strict). I wonder if it works with the frameworks Javascript if I put this command in a file .js, or if it only works with pure Javascript? Because it is only supported by the latest versions of some browsers, it is currently possible to use it?

1 answer

1


It depends on the case. But the frameworks more modern are usually compatible and even make extensive use this way. The older ones have started to adapt but have to analyze case by case. jQuery and Angular are examples that work well, I imagine worth the same for React, Vue, etc.

You have to test and see, but the chance to work is great, after all, its use is a "good practice" in many situations.

Understanding their use.

  • Would it be a good idea to start developing a project using this directive, knowing that older browsers ignore it? Wouldn’t create any unexpected problems?

  • In general yes. The fact of being ignored is not a problem in the functioning of script because it will only allow things that are probably not in your code that must have been tested with enabled mode. It can become a problem when you start mixing code that is well adapted to the mode and not adapted code. In general codes of these frameworks are written with this in mind. And even when it doesn’t, it will be rare, but not impossible, to cause some problem with other codes.It would only happen if an excerpt that is not there Strict require another not to be working. Only poorly done code does this

  • Got it thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.