Arithmetic Operators
JavaScript Arithmetic Operators
Arithmetic operators are used to perform arithmetic between variables and/or values.
Given that y = 5, the table below explains the arithmetic operators:
Oper | Name | Example | Results | Try it |
---|---|---|---|---|
+ | Addition | x = y + 2 | y=5, x=7 | Try it » |
- | Subtraction | x=y-2 | y=5, x=3 | Try it » |
* | Multiplication | x=y*2 | y=5, x=10 | Try it » |
/ | Division | x = y / 2 | y=5, x=2.5 | Try it » |
% | Remainder | x = y % 2 | y=5, x=1 | Try it » |
For a tutorial about arithmetic operators, read our JavaScript Arithmetic Tutorial.
See Also:
Arithmetic Operators (+ - * /)
The Exponentiation Operator (**)
The Remainder Operator (%)
The Increment Operator (++)
The Decrement Operator (--)