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 JavaScript Basics (Retired) Making Decisions with Conditional Statements Boolean Values

Rouillie Wilkerson
Rouillie Wilkerson
10,419 Points

Why var when let is currently being used?

We are being taught to start a variable with "var", when every other source is telling us to switch to "let"? Is there an updated course available?

Rouillie Wilkerson You can use any of them. It still is supported. I do believe there is an updated one about to come out, so maybe in there they will require it. Its good you caught that and code with all of them. I been doing it every way and it has worked for the most part.

1 Answer

Hey Rouillie Wilkerson,

That’s a great question! You are right, most of the videos you watch will use let or const. And there are definitely some differences between them. I believe the reason you’re seeing var in some of the videos is simply due to the age of the recording. That being said, what you’re learning is still applicable.

If you’re just getting started with JavaScript, I wouldn’t stress over it too much. But if you want to dive deeper into the differences, here’s a very popular Stack Overflow thread on the topic. It’s a popular question!

Happy coding!