forked from bethrobson/Head-First-JavaScript-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththingamajig.html
More file actions
38 lines (37 loc) · 698 Bytes
/
thingamajig.html
File metadata and controls
38 lines (37 loc) · 698 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>The Thing-a-ma-jig</title>
</head>
<body>
</body>
<script>
function clunk(times) {
var num = times;
while (num > 0) {
console.log("clunk");
clunkCounter = clunkCounter + 1;
num = num - 1;
}
}
function thingamajig(size) {
var facky = 1;
if (size == 0) {
console.log("clank");
} else if (size == 1) {
console.log("thunk");
} else {
while (size > 1) {
facky = facky * size;
size = size - 1;
}
clunk(facky);
}
}
var clunkCounter = 0;
thingamajig(5);
console.log(clunkCounter);
</script>
</body>
</html>