Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript The JavaScript 'use strict' Statement

Do we need "use strict" in javascript files anymore?

Actually, I've not seen "use strict" in any of the javascript projects lately, So I was wondering, is it redundant now?

2 Answers

Steven Parker
Steven Parker
231,846 Points

Strict mode is not the default, and may never be. You can use it or not as you see fit. Some folks might argue that it is a "best practice", but others may insist that it's not necessary and impedes responsible creativity.

Adding it to your script enforces strict rules, and also communicates to anyone reading it that your program is compliant with those rules.

I generally don't use it, but even so I do try to code in a way that would work if you turned it on.

I see. Thank you.