Is it safe to use 'use strict' in IE 8/9

Shabith picture Shabith · Aug 14, 2013 · Viewed 8.3k times · Source

According the this http://caniuse.com/use-strict 'use strict' does not support in IE version 8/9.

My question is, Is it really safe to use 'use strict' in IE 8/9 or browsers that its not compatible with? Will it break my code?

Answer

SheetJS picture SheetJS · Aug 14, 2013

The statement "use strict"; will should not cause problems with IE8/9 insofar as the browsers will run the code. (It was designed that way, to ensure that there are no problems with browsers that don't implement strict mode)

External source: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/

This means that you can turn strict mode on in your scripts – today – and it’ll have, at worst, no side effect in old browsers.

NOTE: as Jeremy pointed out in the comments, there are some expressions which are technically valid but will fail in IE8 (for example: var x = {}; x.break = true will not work in IE8 even though it will work in IE9).