-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForLoop.html
More file actions
35 lines (34 loc) · 929 Bytes
/
ForLoop.html
File metadata and controls
35 lines (34 loc) · 929 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
35
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>For Loop</h1>
<script>
for(var i=1; i<=10; i++) {
if(i==3) { continue;}
document.write("<p>The number is " + i + "</p>");
}
document.write("<hr>");
for(var i=1; i<=10; i++) {
if(i %2==1)
document.write("<p>The Odd number is " + i + "</p>");
}
document.write("<hr>");
document.write("ODD EVEN");
document.write("<br>*************");
for(i=1;i<=10;i++){
if(i===10) { break;} // strict comparison of values considering the datatype also.
if(i%2==1){
document.write("<br>"+i);
}
else{
document.write(" "+i);
}
}
</script>
</body>
</html>