Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Rouillie Wilkerson10,407 Points
Let vs Var...
Steven Parker210,850 Points
Some of the videos have not been revised for a while. Since ES6 (2015), "let" and "const" have become the common choices for variable declarations. "Const" is preferred when possible, and "let" if the variable will be changed.
Just be aware that they both have block scope, and are not hoisted. Use "var" if you need hoisting or function scope (but with good planning, neither should be necessary).
I'll admit that personally, I still like to use "var" for global variables just as a way to distinguish them at first glance.