- Info:

- This tutorial shows how to use Arithmetic Operators in JavaScript: - + - * / % ++ -- !.

- Example:

- Create D\Temp\JavaScript\Test.html

Test.html

<script type="text/javascript" language="javascript">

x = 10;

y = 20;

negate     =  -y;        //  -20 = -20

add        = x+y;        //10+20 =  30

subtract   = x-y;        //10-20 = -10

multiply   = x*y;        //10*20 =  200

divide     = x/y;        //10/20 =  0.5

reminder   = x%y;        //10%20 =  0*20+10 = 10

increment1 = ++y;        //21    Increment y by 1 and then store x into increment1.

decrement1 = --y;        //20    Decrement y by 1 and then store x into decrement1.

increment2 =   y++;      //20    Store y into increment2 and then increment x by 1.

decrement2 =   y--;      //21    Store y into decrement2 and then decrement x by 1.

invert1    = !true;      //false Inverts value of boolean. Result can be only false or true.

invert2    = !1;         //false Inverts value of boolean. Result can be only false or true.