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 » |
++ | Increment | x = y++ | y=6, x=5 | Try it » |
++ | Increment | x = ++y | y=6, x=6 | Try it » |
- | Subtraction | x = y - 2 | y=5, x=3 | Try it » |
-- | Decrement | x = y-- | y=4, x=5 | Try it » |
-- | Decrement | x = --y | y=4, x=4 | Try it » |
* | Multiplication | x=y*2 | y=5, x=10 | Try it » |
** | Exponentiation | x = y ** 2 | y=5, x=25 | Try it » |
/ | Division | x = y / 2 | y=5, x=2.5 | Try it » |
% | Remainder | x = y % 2 | y=5, x=1 | Try it » |
Learn More:
Study our JavaScript Arithmetic Tutorial.
See Also:
Arithmetic Operators (+ - * /)
The Exponentiation Operator (**)
The Remainder Operator (%)
The Increment Operator (++)
The Decrement Operator (--)