Exercise

Let’s take a quick breather to try out setting variables ourselves. Head over to your browser and open up the JavaScript developer console. On Google Chrome this can be done by going to: view > developer > JavaScript console

Then you will see the following pane open up.

Now carry out the following steps:

  • Declare a variable with a name of your choosing and assign it a numerical value of your choice.
  • Type the name of your variable back into the console.
  • See what happens.

You should see the console repeat your assigned value back to you. If you don’t see this, read through the above code again and repeat these steps until you do see your assigned value repeated back to you.

Operators

Now we can start to have some real fun with JavaScript. Let’s take a look at operators. Operators are ways of carrying out an ‘operation’ (or a task) on our data. So, for example, we can use the + operator to add numbers together like so: