Friday, October 17, 2014

Write A program to print Ternary Operator using Javascript (using variable).


Write A program to print Ternary Operator using Javascript (using variable).
Code : ternary.html

<!-- Write a java script program using Conditional / Ternary Operator -->
<html>
<body>
<script type="text/javascript">
var a="bca";
var b="bba";
var c= ( a!=b) ? "Yes" : "No" ;
document.write("conditional Operator ( (condition) ? true value : false value ) = ");
document.write(c);
</script>
</body>
</html>

No comments: