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

Pedro Orellana
PLUS
Pedro Orellana
Courses Plus Student 835 Points

Can we use "const, let" to define variables instead of using var? Is there a video that explains we can also use them?

A course in another site implemented the use of 'const' and 'let' right away and did not use 'var' to define variables. I know this is used in the newest version of JS. I'm new to Treehouse and wanted to know if theres a video that also explains we can use const and let. Thanks!

3 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hi Pedro,

There is a Workshop that introduces const and let.

I would recommend, however, that if you are going through the older JS course, you may want to stick with var in the challenges, as the code checkers may not be updated to the new syntax. What may, in fact, be correct and current syntax may result in a Bummer! in an older course's challenge.

Hope that helps! :) :dizzy:

Mike Hatch
Mike Hatch
14,940 Points

This sounds like a case of too many courses at once creating a conflated confusion.

Wes Bos's article on the topic helped me understand the big picture behind the current state of var, let and const. (You may want to read his let and const article while you're at it.) What this particular article helped me understand is that even at the top of the Web Developer Food Chain, the opinions and choices can vary widely.

A rich history of the languages is important for us to know in the future to understand older tech. Old tech will remain. There's old tech and there's new tech. var = old tech. let = new tech.