Triple operator:
A ternary operator represented by a name requires three operands.
The syntax is condition ? result 1: result 2;. Here you write the condition before the question mark (?) and then the result 1 and result 2 separated by a colon (:). Result 1 if the condition is met, otherwise the result will be 2.
<script type="text/javascript"> var b=5; (b == 5) ? a="true" : a="false"; (" --------------------------- "+a); </script>
Results: ------------------------------------------------------------------------------------------------------------------------------
<script type="text/javascript"> var b=true; (b == false) ? a="true" : a="false"; (" --------------------------- "+a); </script>
Results: ------------------------------------------------------------------------------------------------------------------------------
The above is the full understanding of the javascript ternary operator that the editor brings to you. I hope everyone supports me~