Chapter 2 - Variables: storing data in your programs
Click the title to see the listing, solutions to exercises and video tutorials on this site. Click the JS Bin code to see the live listing on JS Bin.
Listing | Title | JS Bin |
---|---|---|
2.01 | Declaring a variable | potazo |
2.02 | Assigning a value to a variable | yuvoju |
2.03 | Using a variable | huvime |
2.04 | Variables vary | jasafa |
2.05 | Assigning text to variables | hobiqo |
2.06 | Declaring and assigning in two steps | vegoja |
2.07 | Declaring and assigning in one step | dorane |
2.08 | Using a variable’s current value to set its new value | kijuce |
2.09 | Valid and invalid variable names | biqawu |
Extras: Using recent language features
Use let
when you may want to assign new values to a variable. Use const
if you will only assign the variable a value once.
Listing | Title | JS Bin |
---|---|---|
2.10 | Declaring and assigning a variable with let | lebisup |
2.11 | Declaring and assigning constants with const | tosixe |
2.12 | Using template literals when logging variables | yenuxuh |