+ 2
Why do we use 'use strict' in JavaScript ? 🙄🙄
Any particular reason? 😅👁️👁️
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
+ 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