The js judgment I learned today is similar to the C language. I wrote a few simple examples to review. I won’t talk about the final running results
<script><br>//Judge<br>var age=20;<br>if( age>18 )<br>{<br>alert("Adult");<br>}<br>alert( "Okay, okay, got it");<br></script>
<script><br>//Judge <br>var age=15;<br>document.write("Your age is"+age);<br>if( age>18)<br>{ <br>alert("You're an adult");<br>}<br>else<br>{<br>alert("You're still young");<br>}<br>alert("Age determines your spiritual world, cherish it");<br></script> ;<br></body><br></html></p>
<p><html><br><head><br><meta charset=utf-8><br></head><br><body><br><script> <br>var pass=60;<br>var score=59;<br>if(score<pass)<br>alert("Failed, no food to eat at night.");<br>else<br>alert("Passed, not bad.");<br> alert("Goodbye");<br></script>
The above is the content of JavaScript control judgment learning notes. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!