Types of Arithmetic Operators in JavaScript

Arithmetic Operators in JavaScript

Learn what is arithmetic operators in javascript with examples. JS has five different types of arithmetic operators.

  1. “+” plus sign indicates addition operator. It is used to sum two or more numbers.
  2. The “-“ minus sign indicates the subtraction operator. It is used to find the difference between two numbers.
  3. The “*” star symbol indicates the Multiplication operator. It is used to find a product of two or more numbers.
  4. “/” forward slash symbol indicates Division operator. It is used to find quotient of a division operation.
  5. 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:

arithmetic operators in javascript

Leave a Reply