Use if/else statement to check int value - Javascript Statement

Javascript examples for Statement:Quiz

Description

Use if/else statement to check int value

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
var age = 25;/*from  w  w  w  . j  ava 2  s . co  m*/

if (age > 18) {
    document.getElementById("demo").innerHTML = "Old enough";
} else {
    document.getElementById("demo").innerHTML = "Too young";
}
</script>

</body>
</html>

Related Tutorials