CodesJava

Easy learning with example program codes

javascript special operators tutorial


Operator Description
(?:) Conditional Operator
typeof Returns the type of object
instanceof Returns true if an object is an instance of an object type

JavaScript Special Operators Example:

<html>
<head>
<script type="text/javascript">
            var a = 10;
            var b = 20;
            var c = 10;
            var d = "String";
            var linebreak = "<br />";
 
            document.write ("((a > b) ? 100 : 200) => ");
            result = (a > b) ? 100 : 200;
            document.write(result);
            document.write(linebreak);
 
            document.write ("((a < b) ? 100 : 200) => ");
            result = (a < b) ? 100 : 200;
            document.write(result);
            document.write(linebreak);
 
            result = (typeof c == "string" ? "C is String" : "D is Numeric");
            document.write("Result => ");
            document.write(result);
            document.write(linebreak);
 
            result = (typeof d == "string" ? "C is String" : "C is Numeric");
            document.write("Result => ");
            document.write(result);
            document.write(linebreak);
      </script>
</head>
   <body>
   </body>
</html>

Try it:

JS Bin on jsbin.com
 



Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2019 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki