Nested If Statements

The sample code below shows how to use if statements inside other if statements (nested if statements). The video here explains all about nested if statements!

<!DOCTYPE html>
<html lang="en"
 <meta charset="utf-8"/>
 <title>JavaScript - Nesting If Statements</title>
 <script type="text/javascript">
 var age = 21;
 var maxAge = 30;
 var minAge = 18;
 // Below is an example of using if statements inside other if statements
 // This is called nested if statements.
 document.write("You are within the accepted age range.");
 document.write("You are above the accepted maximum age.");
 document.write("You are under the accepted minimum age.");