-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
42 lines (36 loc) · 841 Bytes
/
index.html
File metadata and controls
42 lines (36 loc) · 841 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
36
37
38
39
40
41
42
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Planets</title>
</head>
<body>
<div id="main">
</div>
<style>
#main{
font-weight: bold;
color: blue;
}
</style>
<script>
var planetNames = ["Jupiter", "Venus", "Saturn", "Mars","Zimbar"];
var distancesFromEarth = [5.2, 0.72, 9.5, 1.5, 2.2];
var sunnyInAugust = [false, true, false, true,true];
let body = document.getElementById("main");
let bodyContent = "";
let sunnyPlanets = "";
for(var i = 0; i < planetNames.length; i++)
{
bodyContent+=planetNames[i]+"<br />";
bodyContent+=distancesFromEarth[i]+"<br />";
bodyContent+=sunnyInAugust[i]+"<br />";
bodyContent +="----------<br />";
if(sunnyInAugust[i]){
sunnyPlanets+=planetNames[i]+", ";
}
}
body.innerHTML = bodyContent+sunnyPlanets.slice(0,-2)+" are Sunny in August.<br />";
</script>
</body>
</html>