简体   繁体   中英

Strict Mode in JavaScript works with their frameworks?

I am studying JavaScript and came across the Strict Mode ("use strict"). I wonder if it works with JavaScript frameworks(like jQuery, Angular.js, etc) if I put this command in a .js file, or if only work with pure JavaScript? And It is currently feasible to use it? because it is only supported by the latest versions of some browsers.

strict mode is subset of javascript and it written as a string "use strict" so if older browser doesn't support the strict mode then it consider as a simple string and just ignore it and you code work as simple javascript so it is feasible to use. I could not find strict mode in jQuery source code but I'm not sure about that.

Strict Mode is a execution mode of javascript, it has nothing to do with libraries like jQuery or angularjs.

So yes you can use strict mode in your code even though you are using some javascript libraries. But when you use strict mode make sure that the mode is applied only those code which you have authored, because we won't know whether another persons code is compatible with this mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM