-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path13-switchStatements.html
More file actions
34 lines (28 loc) · 891 Bytes
/
13-switchStatements.html
File metadata and controls
34 lines (28 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Demo</title>
</head>
<body>
<script type="text/javascript">
// Switch statements - like If but better
var name = 'Zoe';
switch(name) {
case 'Jenn':
document.write('You love your wife.');
break; // This statement will stop the iteration
case 'Zoe':
document.write('First daughter');
break;
case 'Zenna':
document.write('Second daughter');
break;
// default answer
default:
document.write('This is the default answer.');
}
</script>
</body>
</html>