Sharecodepoint App Download Qrcode Sharecodepoint Android App Banner
Now You can search anything in sharecodepoint using your voice. Click on mic button. Sharecodepoint Youtube Channel

Hi All, Please give your feedback on google. Your Feedback is Important to Us Write Feedback





Sharecodepoint popular queries

Thursday, 28 December 2017

JavaScript Tutorial : Introduction to operators in JavaScript - Javascript Arithmetic Operators

Introduction To Operators in JavaScript
1→ Arithmetic Operators
2→ Comparison Operators
3→ Logical Operators
4→ Assignment Operators
5→ Condition Operators

Arithmetic Operators :

Operators   Description         Example
+                   Addition             var c = a + b;
-                    Subtraction        var c = a - b;
*                   Multiplication    var c = a * b;
/                    Division             var c = a / b;
%                  Modulus             var c = a % b;
++                 Increment           var c = ++a;
–                    Decrement         var c = -- a;

Examples on Arithmetic Operator : 

Addition Example:-
<html> 
 <head> 
   <body> 
      <script > 
          var b = 10,c = 15; 
          var a = b + c; 
          document.write(a); 
      </script> 
    </body> 
  </head> 
</html>
Output : 25

Subtraction Example:-
<html> 
 <head> 
   <body> 
      <script > 
          var b = 10,c = 5; 
          var a = b - c; 
          document.write(a); 
      </script> 
    </body> 
  </head> 
</html>
Output : 5

Multiplication Example:-
<html> 
 <head> 
   <body> 
      <script > 
          var b = 2,c = 3; 
          var a = b * c; 
          document.write(a); 
      </script> 
    </body> 
  </head> 
</html>
Output : 6

Division Example:-
<html> 
 <head> 
   <body> 
      <script > 
          var b = 10,c = 5; 
          var a = b / c; 
          document.write(a); 
      </script> 
    </body> 
  </head> 
</html>
Output : 2

Modulus Example:-
<html> 
 <head> 
   <body> 
      <script > 
          var b = 10,c = 5; 
          var a = b % c; 
          document.write(a); 
      </script> 
    </body> 
  </head> 
</html>
Output : 0

Increment Example:-
<html> 
 <head> 
 </head> 
  <body> 
   <script > 
     var b = 10,c = 5; var a = ++b;//pre-increment b++;//post-increment 
     var e =b; 
     document.write(a); 
     document.write('<br>'); //using HTML code 
     document.write(e); 
    </script> 
   </body> 
</html>
Output : 11
12

Decrement Example:-
<html> 
 <head> 
 </head> 
  <body> 
   <script > 
     var b = 10,; 
     var a = --b; 
     document.write(a); 
    </script> 
   </body> 
</html>
Output : 9

JavaScript Introduction Part 1 : Checkout : Part 1

JavaScript Introduction Part 2 : Checkout : Part 2

JavaScript Introduction Part 3 : Checkout : Part 3
About Developer
Konakalla Premsai
I love to make things simple :)

0 comments:

Post a Comment

 

Version 23.2.3.4 - 2016 - 2019 - © Sharecodepoint | Made in India. | Copyright Content