Arithmetic Operators in JavaScript
Learn what is arithmetic operators in javascript with examples. JS has five different types of arithmetic operators.
- “+” plus sign indicates addition operator. It is used to sum two or more numbers.
- The “-“ minus sign indicates the subtraction operator. It is used to find the difference between two numbers.
- The “*” star symbol indicates the Multiplication operator. It is used to find a product of two or more numbers.
- “/” forward slash symbol indicates Division operator. It is used to find quotient of a division operation.
- The “%” percentage sign indicates the modulus operator. It is used to find the remainder of a division operation.
Example:
document.write("Addition Operator: <br/>");
document.write("2 + 7 = ",2+7 , " <br/>");
document.write("Subtraction Operator: <br/>");
document.write("10 - 7 = ",10-7, " <br/>");
document.write("Multiplication Operator: <br/>");
document.write("5 * 5 = ",5*5, " <br/>");
document.write("Divion Operator: <br/>");
document.write("60 / 2 = ",60 / 2, " <br/>");
document.write("Modulus Operator: <br/>");
document.write("34 % 2 = ",34 % 2, " <br/>");
Output: