The "?" operator is also called the conditional operator. With it you can create the equivalent of an if-else statement, with the following structure:
result = (condition) ? (do this if condition is true) : (do this if condition is false);
Code:
<script type="text/javascript">
//<![CDATA[a = 3;
b = 5;
c = (a > b) ? (a - b) : (b - a);
document.write("absolute value of a minus b = ", c);
//]]>
</script>
Output: