JS Operators

Assignment Operator (=)

Arithmetic Operators

1.       Addition Operator (+)
2.       Subtraction Operator (-)
3.       Multiplication Operator(*)
4.       Division Operator (/)
5.       Modular Operator (%)
6.       Addition Assignment Operator(+=)
7.       Subtraction Assignment Operator (-=)
8.       Multiplication Assignment
9.       Division Assignment
10.   Modular Assignment

Relational and Comparing Operators

1.       Equal (=)
2.       Not equal (!)
3.       Less than (<)
4.       Less than are equal(<=)
5.       Greater than (>)
6.       Greater than are equal(>=)
7.       Identical equal (===)
8.       Identical (!==)

Logical Operators

It is complete the condition indirectly
1.       And (&&)
2.       Or (||)
3.       Not (!)
4.       Increment (++)
5.       Decrement (--)

<html>
    <head>
    <script language="javascript">
                                document.write("<h1>Assignment Operator</h1>");
                                                // var variable assignmentoperator value;
                                    var a=10;
                                document.write("<h1>Arthmatic Operator</h1>");
                                var a=100;
                                var b=20;
                                document.write(a+b);
                                document.write("<br>");
                                document.write(a-b);
                                document.write("<br>");
                                document.write(a*b);
                                document.write("<br>");
                                document.write(a/b);
                                document.write("<br>");
                                document.write(a%b);
                                document.write("<br>");
                                a += 20; // a= a+20; a = 100+20 a= 120;
                                a -= 20; // a= a-20; a = 100-20 a= 80;
                                a *= 20; // a= a*20; a = 100*20 a= 2000;
                                a /= 20; // a= a/20; a = 100/20 a= 5;
                                a %= 20; // a= a%20; a = 100%20 a= 0;
                                document.write("<h1>Comparing Operator</h1>");
                                var a='100';
                                var b='100';
                                if(a !== b){
                                                document.write("Condition True");
                                }else{
                                                document.write("Condition False");
                                }
                                document.write("<h1>Logical Operator</h1>");
                                var a=100;
                                var b=100;
                                if(a==b && a<=b && a>b){
                                                document.write("Condition True");
                                }else{
                                                document.write("Condition False");
                                }                                             
                                if(a!=b || a<b || a>b){
                                                document.write("Condition True");
                                }else{
                                                document.write("Condition False");
                                }                             
                                if(!a<b){
                                                document.write("Condition True");
                                }else{
                                                document.write("Condition False");
                                }                             
                                document.write("<h1>increment Operator</h1>");                      
                                document.write("<h1>Decrement Operator</h1>");                    
                                document.write("<h1>Concatination Operator</h1>");
                                var a=100;
                                var b='200';
                                document.write(a+b);
                                var a='lamp';
                                document.write("<i>"+a+"</i>");
                </script>
    </head>
    <body>
    </body>
</html>

No comments:

Post a Comment