Javascript examples for Statement:if
Use if to check boolean value
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w. ja v a 2 s. c o m*/ var conditionalVar; var meetCondition = true; if (meetCondition) { conditionalVar = "something"; } var variable1 = "variable1"; var variable2 = "variable2"; var someVariable = 'this'+ variable1 + 'something' + variable2 + 'somethingElse' + (conditionalVar ? conditionalVar : ""); console.log(someVariable); } </script> </head> <body> </body> </html>