Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Mathematical Operations
course content

Course Content

Introduction to JavaScript

Mathematical OperationsMathematical Operations

JavaScript can perform the following operations with numbers:

  • Addition (+);
  • Subtraction (-);
  • Multiplication (*);
  • Division (/);
  • Remainder, or Modulo (%);
  • Exponent (**).


If you are already familiar with these operations and how they work, skip to the last section (Priority of Execution of Operations) or proceed with this chapter.

Addition and Subtraction

Multiplication and Division

Remainder (Modulo)

This operation returns the remainder of a division and is performed using the % operator:


This operation raises a number to a certain power. The first number is the base, and the second is the exponent to which it must be raised. It is performed using the ** operator:

Priority of Execution of Operations

Each operation has its execution priority, and the sequence of execution depends on it.


If operations have the same priority, they will be executed from left to right.

You can use parentheses ( ) to modify the priority of execution:


Parentheses () have the highest priority. Inner parentheses are evaluated first, followed by outer ones.

Everything was clear?

Section 3. Chapter 2