Home > Web Front-end > JS Tutorial > body text

JavaScript control judgment learning notes

黄舟
Release: 2016-12-20 15:20:37
Original
1166 people have browsed it

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&gt ;<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)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template