Code Editor
Introduction to JavaScript

Math Operators

Don't worry! Math doesn't need to be your strong-suit to learn JavaScript. However, there are operators you'll need to know to make useful programs.

JavaScript supports the following math operators:

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

These all work how you might guess:

console.log(3 + 4); // Equals 7 console.log(5 - 1); // Equals 4 console.log(4 * 2); // Equals 8 console.log(9 / 3); // Equals 3

In the example above, each line uses a different mathematical operator to log a value to the console.

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.