Exercise Weekend

Goal: In the Variables lesson, we learned:

  • Variables, in JavaScript, are written in lower camelcase
  • Variables are set using let and const
  • Variables can be used in arithmetic

Practice creating and utilizing variables by completing the exercises listed below. Variables are a fundamental building block of programming; so begin getting comfortable with them now!

Warm Up

  • When are let and const used? What do they mean - and how are they different from var?
  • How can we use a variable after we've defined it?


Variables Practice

Here are a few exercises for you to practice using variables:

  • Set a variable called someName equal to your name. Put your name in quotation marks.
  • Display the value of someName in the console.
  • Change the value of someName.
  • Set a variable called favoriteNumber equal to your favorite number.
  • Calculate what your favorite number divided by 2 is.
  • Set another variable called michaelsFavorite equal to 13.
  • Change the value of michaelsFavorite to 7.
  • Subtract your favorite number from mine.
  • Change the value of my favorite number to be 26 times its current value.

Lesson 9 of 62
Last updated January 3, 2022