forked from ivanovyordan/fizzbuzz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
43 lines (39 loc) · 1.07 KB
/
index.html
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
43
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Hacktoberfest Fizzbuzz</title>
</head>
<body>
<div id="container"></div>
</body>
<script charset="utf-8">
const container = document.querySelector('#container');
for(let i = 0; i < 1000; i++) {
const node = document.createElement('div');
if (i % 3 === 0 && i % 5 === 0) {
node.innerText = 'fizzbuzz';
node.style.background = "yellow";
node.style.color = "white";
}
else if(i % 3 === 0) {
node.innerText = 'fizz';
node.style.background = "blue";
node.style.color = "white";
}
else if (i % 5 === 0) {
node.innerText = 'buzz';
node.style.background = "brown";
node.style.color = "white";
}
else {
node.innerText = 'None';
node.style.background = "red";
node.style.color = "white";
}
node.innerText = i + ' - ' + node.innerText;
container.appendChild(node);
}
</script>
</html>