JavaScript Arithmetic
JavaScript Arithmetic Operators
Arithmetic operators perform arithmetic on numbers
| Operator |
Description |
| + |
Addition |
| - |
Subtraction |
| * |
Multiplication |
| / |
Division |
| % |
Modulus |
| ++ |
Increment |
| -- |
Decrement |
Arithmetic Operations
A typical arithmetic operation operates on two numbers.
The two numbers can be literals or Variables
The addition operator (+) adds numbers:
Example
<script>
var x,y,z; ⁄ ⁄declare vaariables
x=5;
y=10;
z=x+y;
document·write("Addition of "+ x +"+"+ y+"="+z+"<br/>");
</script>
Run Example>>
Note:
Using "+" we can concate string in Javascript;