Don’t worry, math does not need to be your strong-suit to learn JavaScript. There are just a few operations we’ll need to know to make some awesome programs later in the course!).

JavaScript includes the general math operators that you can find on a calculator:

  1. Add: +
  2. Subtract: -
  3. Multiply: *
  4. Divide: /

These all work how you might guess: 3 + 4 will equal 7, 50 / 10 will equal 5.

Let’s use each one of these math operators.



Inside of a console.log, add 3.5 to your age.

This is the age you’ll be when we start sending people to live on Mars.


On a new line write another console.log. Inside the new console.log‘s parentheses, take the current year and subtract 1969.

The answer is how many years it’s been since the 1969 moon landing.


Create another console.log, then divide 65 by 240.


Create one last console.log, then multiply the full answer from step 3 by 100.

That’s the percent of the sun that is made up of helium. Assuming we could stand on the sun, we’d all sound like chipmunks!

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Already have an account?