Mit arithmetischen Operatoren kann man mathematische Operationen mit ausführen.
| Operator | Bedeutung |
|---|---|
| + | plus |
| ++ | inkrement |
| - | minus |
| -- | dekrement |
| * | mal |
| / | dividiert |
| % | modulo |
Beispiel:
let x = 11;
let mod1 = x % 2;
let mod2 = x % 3;
alert("The remainder of the division " + x + "/ 2 = " + mod1);
alert("The remainder of the division " + x + "/ 3 = " + mod2);
Inkrement und Dekrement:
let count = 0
count++;
alert(count);
count--;
alert(count);