JavaScript comes with operators for various operations. This section discusses those operators.

These are probably the most often used operators. I’ll use examples to explan them. Here is the first example.

var result; var a=5; var b = 17; var c = "some string"; var d = "another string"; result = a + b; // Addition document.write("The result of addition is " + result); result = a - b; // Substraction document.write("<br/>The result of subtraction is " + result); result = a * b; // Multiplication document.write("<br/>The result of multiplication is " + result); result = b / a; // Division document.write("<br/>The result of division is " + result); result = b % a; // Modulus document.write("<br/>The division remainder ...

Start Free Trial

No credit card required