+ 2

Why do we use 'use strict' in JavaScript ? 🙄🙄

Any particular reason? 😅👁️👁️

17th Sep 2019, 3:28 PM
Darshan Raval
Darshan Raval - avatar
2 Réponses
+ 5
I had a particular situation with a function that had several arguments and it was difficult to notice that some of those were actually the same for ie:(a,b,c,g,r,a,h) - here a is written twice. When I introduced 'use strict' visual studio pointed to that line saying that there is an error. After few of likewise situations use script is my regular start of JavaScript scripts. More info: https://www.w3schools.com/js/js_strict.asp
17th Sep 2019, 7:59 PM
Dejan Dozet
Dejan Dozet - avatar
+ 3
In short: It forces you to write cleaner code and it's faster due to better optimisation possibilities. Further information: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
17th Sep 2019, 3:52 PM
Aaron Eberhardt
Aaron Eberhardt - avatar