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 Getting Started With ES2015!
You have completed Getting Started With ES2015!
Preview
Using the keyword `const` to create variables have a number of benefits including the ability to prevent the value from being reassigned.
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
This is often the best choice for
declaring variables.
0:00
Const is short for constant, meaning
that the value of the variable shouldn't
0:00
change, it should remain constant.
0:04
For example, const pi is equal to 3.14159.
0:07
Const lets you protect variables from
being overwritten by any stray assignments
0:12
in your code.
0:17
In other words, once you create a
constant, you can't give it another value.
0:18
Let me show you what I mean.
0:23
If you want to follow along, you can
open up the workspace on this page.
0:25
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