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 trialtal Shnitzer
Courses Plus Student 5,242 Pointswhat is the "const" keyword?
how is it different from "var"? why is it used in this program and not var?
2 Answers
Unsubscribed User
Full Stack JavaScript Techdegree Graduate 23,972 PointsHello Tal
The const keyword is used when you don't want the identifier to be reassigned. Const doesn't replace var but you can use let interchangeably with var. Also Const and Let give more specific scope. Hopefully I was able to help you! Happy Coding
Jason Anders
Treehouse Moderator 145,860 PointsHi Tal,
The const
keyword was introduced in ES2015. Treehouse does have an Introduction to ES2015 course. This course will cover all the changes to JavaScript with the ES2015 introduction.
There is also a a very quick (14 minutes) Workshop here that covers Defining Variables with Let and Const.
For now, I'd recommend at least doing the Workshop. Then if JavaScript is a path you are wishing to go down, the ES2015 course would be a next logical choice.
Keep Coding! :)