Types of Arithmetic Operators in JavaScript
What is Operators
The name might be a bit of a giveaway but, Arithmetic operators pretty perform arithmetic functions on numbers (both literals and variables).
Types of Arithmetic Operators
As you can see there ar 7 types of Arithmetic Operators total. Below I will explain them with code.
Addition Operator (+)
var j, i = 10; j = i + 10; //Here '+' is used for sum console.log(j)
Here you can see the addition operator (+) in action determining the sum of two numbers
You can add as many numbers or variables together as you want or need to.
Multiplication Operator (*)
We use the '*' (Asterisk symbol) operator to multiply one number by the other.
var j, i = 10; j = i * 10; //Here '*' is used for multiplication document.write(j)
Post a Comment