 Hello everyone, I hope you are fine. In today's tutorial, we are gonna take a look at “Mathematical operators in JavaScript” in detail. Performing math operator in different programing language is very common. JavaScript also allows several operators to help us in numbers.  The mathematical operator in JavaScript is used for performing certain different tasks such as the final price of a financial transaction, browser windows size and calculating the range between the element in a website document.  There are two types of operator that I am going to discuss in this tutorial.
1. Arithmetic operator
2. Assignment operator

## Arithmetic Operators in JavaScript

To perform an action between two variable or values we use mathematical operators. In the equation 3+2 = 5 (+ is a syntax). Java script has many different operators some are basic math operator and others are additionals operators particular to programming. A table of JavaScript Operators
 Operator Description Example Definition + Addition 2 + 3 Sum of 2 and 3 - Subtraction 9 - 2 Difference of 9 and 2 * Multiplication 3 * 2 Product of 3 and 2 / Division 10 / 5 Division of 10 and 5 % Modulo 9 % 2 Remainder of 9 and 2 ** Exponentiation 9 ** 3 9 to the 3 power ++ Increment 9++ 9 plus one -- Decrement 9-- 9 minus one
Let me explain to you all of these operators in detail.

### Addition and Subtraction in JavaScript

Addition and subtractions are the operators from basic maths. They are used to find the sum and difference of two numerical values.  JavsScript has its own built-in calculator. All these mathematical operators can be directly performed in the console. As you have seen a simple example of addition and now I am going to explain it with detail. Now I will assign numerical values to a and b and place the sum in c
• Suppose: a = 3;   b = 4;
• Now add a + b and assign the sum of a+b to c
• c = a + b;  alert(c);

Output In a similar way, subtraction(-) also work with the same formula but will subtract the number.
• Suppose: a = 6;  b = 3;
• Now subtract a - b and assign the diffrence of a-b to c
• c = a - b;  alert(c);
• Now subtract a - b and assign the difference of a-b to c
• c = a - b;  alert(c);
Output There is one another fact about the (+)operator that you should know that adding a numeric number and string.  As we all know that 1 + 2 return the value of 3. But this will have an unexpected result.
Output: The result of this will be 12 because of the one string value(“2”),  javascript concatenate (Concat() function is used to join two or more string together)  it rather than adding 1 and 2. So it is really important to be careful because while coding in JavaScript. Therefore JavaScript is case sensitive language.

### Multiplication in JavaScript

Multiplication (*) and division (/) are also used in Javascript to find the numeric values by division or multiplication.  Multiplication could be used many times like calculating the price of any item etc and division help you in finding the time like the number of hours or minutes.
• z = x * y;

• z = x / y;

### Modulus in JavaScript

Modulo (%) is used to find the remainder of a quotient after division. It can help us find in that even if the number is even or odd. It is less familiar operator than others. It is also known as Modulus too.
• z = x % y;

### Exponentiation in JavaScript

Exponentiation (**) is the new operator in JavaScript. Its calculate the power of a number by its exponent. Its written like this 8^4 (Eight to the 4 power).

• z = 8 ** 4;
Output 8 ** 4 represents the same as 8 multiplied by 8 four times: 8 * 8 * 8 * 8

### Increment and Decrement in JavaScript

The increment operator (++) increase the numerical value of a variable by one and on the other side decrement operator (--) decrease the numerical value of a variable by one. They are often used with loops. You can use these operators with variable only and using them with raw numbers can only result in an error. Look in the example. Increment and Decrement are further divided into two classes: prefix operation and postfix operation. Firstly,  prefix operator. let x = 8; prefix = ++x; alert(prefix); Output 