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

Should we nolonger use var?

I just want to make sure i'm understanding the lesson correct.

From what I've gathered, var is considered an older practice and it is recommended not to use it in And today's age is recommended replaced with either let or const?

1 Answer

Jonathan Rhodes
Jonathan Rhodes
8,086 Points

let and const are a way to name variables in ES6, which will be the new standard in a few years. However, it is not currently supported by all browsers, so it is a risky move to code in unless you are using something to interpret it into ES5. var, the way to declare variables in ES5 will work in all browsers. As of right now, if you are just programming pure JavaScript, it's probably safer to use ES5.