Changes

Jump to: navigation, search

JavaScript Operators

724 bytes added, 19:52, 19 April 2007
Arithmetic Operators
adds the value of 2 to the value of 5 and assigns the result (7 in this case) to the variable ''y''.
 
Arithmetic operatations can also be perform on variables:
 
<pre>
y = 10;
x = y + 5; // Assigns the value 15 to variable x
x = x + y; // Assigns the value 25 to x (since x now contains the value 15
</pre>
 
The key arithmetic operators are:
 
<table border="1">
<tr>
<th>Operator</th><th>Description</th>
<tr>
<td>+<td>Addition - Adds left hand value to right hand value </td>
<tr>
<td>-<td>Subtraction - Subtracts left hand value to right hand value </td>
<tr>
<td>*<td>Multiplication - Multiplies left hand value by right hand value </td>
<tr>
<td>/<td>Division - Divides left hand value by right hand value</td>
<tr>
<td>%<td>Modulus - Divides left hand value by right hand value and returns remainder</td>
</table>

Navigation menu