44

I'm wondering when ECMAScript 6 comes, do we still need to put "use strict" in js codes?

nightire
  • 1,350
  • 2
  • 11
  • 21

1 Answers1

32

Yes, unfortunately. Except in modules, where it is implied.

Andreas Rossberg
  • 31,309
  • 3
  • 55
  • 70
  • 5
    It's worth noting that modules is the expected way to work with big applications in ECMAScript 6, so there's a silver lining here. – Nacho Coloma Jan 10 '15 at 12:59
  • @zhon, for modules, as noted (also, for classes). Not sure what you are asking specifically. – Andreas Rossberg May 23 '15 at 08:22
  • @AndreasRossberg, I think you said there are some case where "use strict" is implied and not needed. What are examples of this? – zhon May 25 '15 at 13:29
  • @zhon, I'm still confused what you are asking, since I thought I already answered that: inside modules and inside classes. If that does not answer your question, can you rephrase it? – Andreas Rossberg May 25 '15 at 17:38
  • @AndreasRossberg Thank you for clarifying. I was having trouble parsing the english. Classes and modules do not need "use strict". – zhon May 27 '15 at 14:54
  • Is this answer still true in 2019? – Scribblemacher Jul 25 '19 at 12:29
  • @Scribblemacher, yes, and it will never change, since JS cannot make backwards-incompatible changes -- they would break the web. – Andreas Rossberg Jul 25 '19 at 16:24