arithmetic javascript code example
Example 1: javascript 1 + "1"
console.log(10+"1");
console.log(10-"1");
Example 2: 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 3: 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 4: javascript ... operator
var [head, ...tail] = ["Hello", "I" , "am", "Sarah"];
console.log(head);
console.log(tail);
let a = [2,3,4];
Math.max(a)
Math.max(...a)