Tenary operator : Conditional Operator « Operators « JavaScript Tutorial






<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
var w = 1, x = 2, y = 3, z = 4, ans;
ans = (w > x) ? y : z
alert(ans);
//  -->
</script>
</head>
<body>

</body>
</html>








2.8.Conditional Operator
2.8.1.The Conditional Operator and if Statement
2.8.2.Tenary operator
2.8.3.Conditional Operator: ?
2.8.4.Finding the absolute value