Section 1: Overview
Examples:
- Addition: 2 + 3
- Addition: ++var1 – increments the value, and then uses the result
- Addition: var1++ – uses the value, and then increments the value
- Subtraction: 4 – 2
- Subtraction: --var2 – decreases the value, and then uses the result
- Subtraction: var2-- – uses the value, and then decreases the value
- Multiplication: 2 * 4
- Division: 3 / 2 (equals 1.5)
- Exponentiation: Math.pow(2,4) – equals 2 ^ 4
-
Modulus: 6 % 4 (equals 2) – result is the
remainder when the first number is divided by the second
number. If either number is a floating-point number, the result is
a floating-point number representing the remainder. For example,
3.5 % 2 = 1.5
Section 2: Assignment Operators
An assignment operator assigns the value of its right operand to its left operand. The basic assignment operator is equal (=), which assigns the value of its right operand to its left operand. That is, x = y assigns the value of y to x.
Think of the assignment operator as a left arrow: ←
The other assignment operators are shorthand for standard operations, as shown in the following table.

Section 3: Operator Precedence
If multiple arithmetic operators are included in a single equation, the operations are performed in a specific order:

Example:

Parentheses can be used to clarify the precedence of operators in an expression, or even alter the precedence. Parentheses have a higher precedence than any operator.
Section 4: Expression Type
Expressions have both a type and a value.

For addition, subtraction, or multiplication, if either operand is real, the result is real.
For real division (/), the result is real regardless of the types of the operands.
More on type conversions in our type conversion notes.