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

Danny Chang
Danny Chang
1,006 Points

let vs var

I used let for this practice assignment.

Everything worked fine, but I saw that they used var in the video.

Does it matter?

1 Answer

Steven Parker
Steven Parker
231,007 Points

In nearly all situations you will encounter in beginner through intermediate exercises, there won't be any practical difference between using let and var for declarations. The differences are mainly related to scope and hoisting.

For the technical details, see these MDN pages on let and var.