문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

yeah, thats right. But some browser not supported.

Actually, a lot of modern browser supported use-strict.

        Internet Explorer = v10,v11
        Firefox           = v4.0 +
                **Webkit** 
        Chrome            = v13.0 +
        Opera             = v11.6 +
        Safari            = v6.0 + 

check it please : http://caniuse.com/use-strict

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top