In this article I would like to share with you how to use If - Else If - Else Statement in JavaScript. This is one of the most common conditional statement in JavaScript that will make your program intelligent.
If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.comand jakerpomperada@yahoo.com. People here in the Philippines can contact me at my mobile number 09173084360.
Thank you very much and Happy Programming.
Sample Program Output
Program Listing
<html>
<head>
<title> If-Else If Statement</title>
<head>
<body>
<script>
var age = 34;
if (age < 18) {
if (age > 0)
{
alert (" You are still a minor.");
}
else {
alert ("Sorry Invalid Age. Try Again !!!");
}
} else if (age >= 18)
{
alert ("You are already an Adult." )
}
</script>
</body>
</html>
No comments:
Post a Comment