Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Basics!
You have completed JavaScript Basics!
Preview
Learn how const and let work, and why you might want to use them instead of var when declaring variables.
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Although many JavaScript programmers
still use the var keyword,
0:00
some of the behaviors of using var
can be problematic or unexpected.
0:00
For instance, a variable might
accidentally get changed or
0:04
overwritten with a different value
further down in your program,
0:07
which can be really difficult to catch.
0:10
The JavaScript programming
language gets updated regularly.
0:13
And nowadays you'll see variables
written using the keywords let or
0:16
const, which let you put a value into
them like you do with the var keyword.
0:18
But they have different rules
about how you use them and
0:22
change their values in your program.
0:25
So now I'll teach you how const and
let work and
0:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up