Loading Please Wait...
Arithmetic operators perform arithmetic on numbers (literals or variables).
The Addition Operator (+) adds numbers:
/* Adding numbers */
let a = 5;
let b = 2;
let c = a + b;
let d = c + 10;
/* Adding string */
let text1 = "John";
let text2 = "Doe";
let text3 = text1 + " " + text2;
/* Adding numbers and string */
let k = 15;
let name = "John Doe";
let add = name + k;
The Subtraction Operator (-) subtracts numbers:
let a = 5;
let b = 2;
let c = a - b;
The Multiplication Operator (*) multiply numbers:
let a = 5;
let b = 2;
let c = a * b;
The Division Operator (/) divides numbers:
let a = 5;
let b = 2;
let c = a / b;
The Modulus Operator (%) returns the division remainder.
let a = 5;
let b = 2;
let c = a % b;
The Increment Operator (++) increments numbers (by 1 each time).
let a = 5;
a++;
let c = a;
The Decrement Operator (--) decrement numbers (by 1 each time).
let a = 5;
a--;
let c = a;
The exponentiation Operator (**) raises the first operand to the power of the second operand.
let a = 5;
let c = a ** 3;
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved