Arithmetic
Apply arithmetic between two values and get a result.
+
• Add two values together. Values can be a mix of numbers, text, variables and objects.
|
var A=1+2;
var B=A+4;
var D="Result is "+B;
var C="Hello"+" "+"World";
-
• Subtract one number from another.
|
var A=3-1;
*
• Multiply two numbers together.
|
var A=2.5*6;
/
• Divide one number by another.
|
var A=10/3;
%
• The remainder, when dividing one number by another.
|
var Remainder=10%3;
++
• Increase a number by 1. The initial number is changed to the result.
|
var A=10;
A++;
--
• Decrease a number by 1. The initial number is changed to the result.
|
var B=3.25;
B--;
+=
• Increase a number by a value. The initial number is changed to the result.
|
var C=4;
C+=2;
-=
• Decrease number by a value. The initial number is changed to the result.
|
var D=8;
D-=6.5;
*=
• Multiply a number by a value. The initial number is changed to the result.
|
var E=7;
E*=3;
/=
• Divide number by a value. The initial number is changed to the result.
|
var A=7;
A/=5;
%=
• Find the remainder of a number when divided by a value. The initial number is changed to the result.
|
var G=9;
E%=4;
( )
• Arithmetic in brackets is calculated before other arithmetic.
|
var A=5+(3/7)+(12*0.25);