Arithmetic Operators


JavaScript arithmetic operators are used to perform arithmetic/mathematical operations on the operands.

1. + (Addition)

document.write(10 + 8);

// prints 18

2. - (Subtraction)

document.write(10 - 8);

// prints 2

3. * (Multiplication)

document.write(10 * 8);

// prints 80

4. / (Division)

document.write(10 / 8);

// prints 2

5. % (Modulus)

document.write(10 % 8);

// prints 2

6. ++ (Increment)

int a = 5;
a++;

document.write(a);

// prints 6

7. -- (Decrement)

int a = 5;
a--;

document.write(a);

// prints 4