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 Defining Variables with let and const!
You have completed Defining Variables with let and const!
Preview
Let's review the original way to declare a variable and how that differs with the modern let and const keywords.
This video doesn't have any notes.
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
[SOUND]
0:00
[MUSIC]
0:01
[SOUND]
>> Hello world, Andrew here.
0:03
Lifelong learner, and
JavaScript teacher here at Treehouse.
0:06
For most of JavaScripts life,
there's been only one way to create or
0:10
declare a variable.
0:14
Using the var keyword.
0:16
Most JavaScript programmers
learned this method, and
0:18
a lot still use the var keyword.
0:21
But some of the behaviors from using
var can be problematic or unexpected.
0:22
That's why developers of
the JavaScript programming language
0:28
decided to introduce new ways for
creating variables.
0:31
The sixth version of JavaScript,
called ES2015, or
0:35
ECMAScript 2015, introduced two
new keywords, const and let.
0:40
In this workshop,
I'll show you how const and let work, and
0:45
explain why you'll want to use them
instead of var when declaring variables.
0:49
But first,
0:54
I just want to mention that const and
let work in a similar way to var.
0:55
In each case you use the keyword var,
const, or
1:00
let, followed by the name of the variable,
an equal sign and
1:03
a value you want to put
into that variable.
1:08
So, when should you use const,
and when should you use let?
1:12
Great questions.
1:15
I'll answer them in the next few videos.
1:16
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