# JavaScript Arithmetic Operators

The JavaScript Arithmetic Operators include operators like Addition, Subtraction, Multiplication, Division, and Modulus. All these operators are binary operators, which means they operate on two operands. The below table shows the Arithmetic Operators with examples.

## JavaScript Arithmetic Operators Example

For this Arithmetic Operators example, We are using two variables a and b, and their values are 12 and 3. We are going to use these two variables to perform various JavaScript arithmetic operations.

```<!DOCTYPE html>
<html>
<title>JavascriptArithmeticOperators </title>
<body>
<h1>PerformingArithmeticOperations </h1>
<script>
var a = 12, b = 3;
var addition, subtraction, multiplication, division, modulus;

subtraction = a - b; //subtract 3 from 12
multiplication = a * b; //Multiplying both
division = a / b; //dividing 12 by 3 (number of times)
modulus = a % b; //calculation the remainder

document.write("Addition of " +a +' and ' +b +" is = " + addition + "<br />");
document.write("Subtraction of " +a +' and ' +b +" is = " + subtraction + "<br />");
document.write("Multiplication of " +a +' and ' +b +" is = " + multiplication + "<br />");
document.write("Division of " +a +' and ' +b +" is = " + division + "<br />");
document.write("Modulus of " +a +' and ' +b +" is = " + modulus + "<br />");
</script>
</body>
</html>```
``````Performing Arithmetic Operations
Addition of 12 and 3 is = 15
Subtraction of 12 and 3 is = 9
Multiplication of 12 and 3 is = 36
Division of 12 and 3 is = 4
Modulus of 12 and 3 is = 0``````

## JavaScript Arithmetic Operators Example 2

For this JavaScript example also, We are using two variables, a and b, and their values are 12 and 3. Here, we are going to use these variables to show you, How to display the JavaScript Arithmetic operations output in Paragraphs.

```<!DOCTYPE html>
<html>
<title>JavascriptArithmeticOperators 2</title>
<body>
<h1>Performing Arithmetic Operations </h1>
<p id = 'sub'> Subtraction </p>
<p id = 'mul'> Multiplication </p>
<p id = 'div'> Division </p>
<p id = 'mod'> Modulus </p>
<script>
var a = 12, b = 3;
var add, sub, mul, div, mod;