-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconditional_statement.html
More file actions
41 lines (35 loc) · 1.25 KB
/
Copy pathconditional_statement.html
File metadata and controls
41 lines (35 loc) · 1.25 KB
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
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Learning JavaScript</title>
</head>
<body>
<center><h1>Conditional Statments</h1></center>
<ol>
<li>Conditional statments are used to perform different actions based on different conditions.</li>
<li>Very often when we write code, we wanted to perform different actions for different decisions.</li>
<li>We can use conditonal statement in our code to do this.</li>
</ol>
<p><strong>var firstName = 'Roopak';<br />
var civilStatus = 'single';<br />
<br />
if(civilStatus === 'married') {<br />
console.log(firstName + ' is married');<br />
} else {<br />
console.log(firstName + ' will hopefully marry soon <br />:)');<br />
}<br />
<br />
var isMarried = true;<br />
if (isMarried) {<br />
console.log(firstName + ' is married!');<br />
} else {<br />
console.log(firstName + ' will hopefully marry soon <br />:)');<br />
}</strong></p><br />
<form action="conditional_statement_result.html">
<input type="submit" name="Check" value="Check">
<p>click 'Check' to see the answer</p>
</form>
</body>
<script src="conditional_statement.js"></script>
</html>