Ultimate Gear War
Join the alien war, prepare your gear and protect your base at all cost!
4.13 / 5.00 17,706 ViewsI've read a lot about the "use strict"; mode that came out not so long ago to JavaScript to optimize code. It makes it easier to make better code.
So, I decided to use the mode in all my JavaScript codes, but in JSHint, it says it have to be defined in every single function. But all I want is to be strict with my whole code. I'm comfused!
Do I have to add "use strict"; to every single function or just at the start of my .js file?
At 4 days ago, Rawnern wrote: I've read a lot about the "use strict"; mode that came out not so long ago to JavaScript to optimize code. It makes it easier to make better code.
So, I decided to use the mode in all my JavaScript codes, but in JSHint, it says it have to be defined in every single function. But all I want is to be strict with my whole code. I'm comfused!
Do I have to add "use strict"; to every single function or just at the start of my .js file?
For anyone coming across this in the future (as the OP posted this a few days ago and likely found the answer already): This suggests throwing it at the top of the file to enable it for the whole script.
Something like this?
http://www-archive.mozilla.org/js/language/js20-2002-04/core /pragmas.html
Need to ask anything about computers and/or programming? Just PM me.
Sig = 50% Amaranthus, 50% Wolfos.
At 16 hours ago, Scyllinice wrote: For anyone coming across this in the future (as the OP posted this a few days ago and likely found the answer already): This suggests throwing it at the top of the file to enable it for the whole script.
Thanks for your help! Exactly what I was looking for.
At 3 hours ago, Wolfos wrote: Something like this?
http://www-archive.mozilla.org/js/language/js20-2002-04/core /pragmas.html
Oh, I´ve already red that one. It´s kinda old. This rule came in 2009 etc...