arithmetic operators javascript code example
Example 1: js calculate
answer_Add = 5 + 1;
answer_Sub = 5 - 1;
answer_Multi = 5 * 5;
answer_Divi = 10 / 2;
Total = answer_Add + answer_Sub + answer_Multi + answer_Divi;
Example 2: javascript Arithmetic operators
var additionOutput = 2 + 2;
var subtractionOutput = 2 - 2;
var multiplcationOutput = 2 * 2;
var divisionOutput = 2 / 2;
var exponentiation = 2**2;
var modulus = 5 % 2;
var unaryOperator = 1;
++unaryOperator;
Example 3: javascript modulo
x = a % b
Example 4: what does -= mean in JavaScript
var myVar = 5;
console.log(myVar)
var myVar = myVar - 3;
console.log(myVar)
var myVar = 5;
console.log(myVar)
var myVar -= 3;
console.log(myVar)