Javascript examples for Operator:Ternary Operator
Use Ternary operator to make multiple operations
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*w w w . j av a 2 s.c o m*/ var flag = true; (flag) ? ( flag = 'a', //first operation letterflag = 'a' //second operation ) : ( flag = 'b', letterflag = 'b' ); console.log(flag); console.log(letterflag); } </script> </head> <body> </body> </html>