"Swift Basics" was retired on May 31, 2020.
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
    
      
  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
                      [MUSIC]
                      0:00
                    
                    
                      Hello world, Andrew here, lifelong learner
and JavaScript teacher here at Treehouse.
                      0:04
                    
                    
                      For most of JavaScript's life,
there's been only one way to create or
                      0:10
                    
                    
                      declare a variable, using the var keyword.
                      0:14
                    
                    
                      Most JavaScript programmers
learned this method and
                      0:18
                    
                    
                      a lot still use the var keyword, but
                      0:21
                    
                    
                      some of the behaviors from using var
can be problematic or unexpected.
                      0:23
                    
                    
                      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 ES 2015 or
                      0:35
                    
                    
                      ECMAScript 2015,
introduce two new keywords.
                      0:40
                    
                    
                      Const and let.
                      0:44
                    
                    
                      In this workshop,
I'll show you how const and let work.
                      0:46
                    
                    
                      And 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 let.
                      1:00
                    
                    
                      Followed by the name of the variable,
an equal sign and
                      1:05
                    
                    
                      the value you want to
put into that variable.
                      1:09
                    
                    
                      So, when should you use const and
when should you use let?
                      1:12
                    
                    
                      Great questions.
                      1:16
                    
                    
                      I'll answer them in the next few videos.
                      1:17
                    
              
        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