Arithmetic operators in Javascript
The arithmetic operators performs basic arithmetic operations for the given variable or value, Arithmetic operation requires minimum two variables or values (operand) to perform operation. It returns the value by performing operation. As it requires minimum two operand, it also called as binary operators.

Arithmetic Operators

1. Addition operator2. Subtraction operator3. Multiplication operator4. Division operator5. Modulus operator

Addition operator

An addition operator adds two variable or value provided to it. It returns the result after performing operation. If multiple operator exists in the operation, it evaluate the operation from left to right.
plus operator
 1 let x = 20;
 2 let y = 10;
 3 // addition of two variables
 4 let z = x + y; // z = 30

Subtraction operator

A substract operator substract right side variable or value from the left side variable or value provided to it. It returns the result after performing operation. The result can be either negative or possible depends on order in which it used. In case of multiple operator exists in the expression, it evaluate expression from left to right.
minus operator
 1 let x = 30;
 2 let y = 15;
 3 // subtraction of two variables
 4 let z = x - y; // z = 15

Multiplication operator

A multiplication operator multiplies either side of variable or value with other one. It returns the result after performing operation. If multiple operator specified in the expression, it evaluate the operation by multiplying from left to right.
multiply operator
 1 let x = 5;
 2 let y = 4;
 3 // multiplying of two variables
 4 let z = x * y; // z = 20

Division operator

The division operator divide left side operand with right side operand. It returns the result after performing operation. If multiple operator specified in the expression, it evaluate the operation by dividing from left to right. In case right side operand is zero, it returns Infinite from the operation.
division operator
 1 let x = 25;
 2 let y = 5;
 3 // division of two variables
 4 let z = x / y; // z = 5

Modulus operator

A modulus operator divides left side operand by right side operand. It return the result as remainder value which less then or zero from the right side operand. If multiple operator specified in the expression, it evaluate the operation from left to right, a left side operators evaluates first.
Modulus operator
 1 let x = 9;
 2 let y = 5;
 3 // mod of two variables
 4 let z = x % y; // z = 4
 5 
Privacy Policy
Terms of Service
Disclaimer
Contact us
About us