OPERATORS

Programming languages use operators to manipulate data. JavaScript includes different types of operators: arithmetic, conditional, and logical operators. In this lesson, you'll look at arithmetic operators; conditional and logical operators are covered in later lessons.

Operators do some action on the information (operands) supplied to them. For example, in this statement

var c = a * b;

a and b are operands of *, the multiplication operator.

JavaScript includes arithmetic operators for all the common mathematical functions. The arithmetic operators are shown in the following table.

Operator Description
+
addition
-
subtraction
*
multiplication
/
division
++
increment (adds 1 to the current value)
--
decrement (subtracts 1 from the current value)
%
modulo (remainder in division)