Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to "use strict" in Javascript? [closed]

I'd appreciate your lessons learnt through experience on when to and when NOT to, "use strict" in Javascript.

IMHO, "use strict" is good in server-side javascript code but NOT client-side, because not all (even modern) browsers support this feature. Correct?

like image 970
karthiks Avatar asked May 02 '26 08:05

karthiks


1 Answers

Read this john resig on strict mode

"use strict"; is as important in client side javascript programming as in server's.

If it is not supported by a browser it would do no harm as it is just a string plus a semicolon .. which would do nothing if not recognized correctly by an interpreter.

With "use strict"; mode .. if your program runs correctly even in one of the modern browsers like chrome then you now know that your program does not have any silly errors. After that you are good to go on any other possible browser because as I said it would do no harm if not interpreted correctly.

like image 111
TwiToiT Avatar answered May 03 '26 20:05

TwiToiT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!