All programming languages have constructs called operators. An operator is a character that represents an action, or sometimes a relationship.

You’re already familiar with operators from when you learned maths: + is an operator that represents the action of addition. Operators in programming work the same way.

There are lots of different kinds of operator. For example, you’ve already used the assignment operator, =, to assign a value to your variable in the last step. For this step, we’re going to start with arithmetical operators, since you already understand how most of them work in the real world.

Arithmetical Operators

JavaScript includes several standard arithmetical operators (+, -, /, *) that you can use to do maths with your numbers.

var sumOfNumbers = 1 + 3;
alert(sumOfNumbers);

This will pop-up an alert box with the number 4.

TIP: Because we’re working with numbers here, we don’t need quotes around our values, 1 and 3.


Tasks

  1. Create 3 variables:
    • 1st variable named ten with value 10 inside
    • 2nd variable named three with value 3
    • 3rd variable named multipleOfNumbers that will be equal to 1st variable multiplied by the 2nd variable.
  2. As a result, display the value of multipleOfNumbers.