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
Using constants are a best practice when assigning variables but what happens when you do actually want to reassign a value? That's where let comes in.
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
Let's take a look at a simple example.
0:00
Open up let.html, and you can
see we've got the score = 0 and
0:00
age = 33, and a boolean is hungry = false.
0:07
Open up the preview and
navigate to let.html.
0:13
Open up the console, and
let's try and modify the score.
0:19
The score can change through a game.
0:27
The score increments by one each time
the player completes a challenge.
0:29
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