Loading Please Wait...

Logo Lynxsia IT Solutions

JavaScript Arithmetic Operators

JS Arithmetic Operators

Arithmetic operators perform arithmetic on numbers (literals or variables).

Addition

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;
        
      
Subtraction

The Subtraction Operator (-) subtracts numbers:

					 
        
          let a = 5;
          let b = 2;
          let c = a - b;
        
      
Multiplication

The Multiplication Operator (*) multiply numbers:

					 
        
          let a = 5;
          let b = 2;
          let c = a * b;
        
      
Division

The Division Operator (/) divides numbers:

					 
        
          let a = 5;
          let b = 2;
          let c = a / b;
        
      
Modulus/Remainder

The Modulus Operator (%) returns the division remainder.

					 
        
          let a = 5;
          let b = 2;
          let c = a % b;
        
      
Increment

The Increment Operator (++) increments numbers (by 1 each time).

					 
        
          let a = 5;
          a++;
          let c = a;
        
      
Decrement

The Decrement Operator (--) decrement numbers (by 1 each time).

					 
        
          let a = 5;
          a--;
          let c = a;
        
      
Exponent

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:

Report Us

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 Us
Ads
Logo
Lynxsia IT Solutions

We 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..

Kotwali Road, Chhiptehri, Banda, 210001, UP, India

Copyright © 2022, Lynxsia IT Solutions, All rights reserved