-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
74 lines (66 loc) · 1.42 KB
/
main.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// model // variables
const display = document.getElementById("display");
let word1 = "_____";
let word2 = "_____";
let word3 = "_____";
let word4 = "_____";
let word5 = "_____";
let word6 = "_____";
// view // what you see
dispFunc();
function dispFunc() {
display.innerHTML = `
<div>Det var en gang, en ${word1} ${word2} som gikk til ${word3} og der var det en ${word4}, dyret var ${word5} i fargen og veldig ${word6}!</div>
`;
}
// controller // apply changes
function updateWords(choice) {
if (choice == 0) {
word1 = "liten";
dispFunc();
}
else if (choice == 1) {
word1 = "stor";
dispFunc();
}
else if (choice == 2) {
word2 = "frøken";
dispFunc();
}
else if (choice == 3) {
word2 = "hærre";
dispFunc();
}
else if (choice == 4) {
word3 = "butikken";
dispFunc();
}
else if (choice == 5) {
word3 = "byen";
dispFunc();
}
else if (choice == 6) {
word4 = "katt";
dispFunc();
}
else if (choice == 7) {
word4 = "hund";
dispFunc();
}
else if (choice == 8) {
word5 = "blå";
dispFunc();
}
else if (choice == 9) {
word5 = "grønn";
dispFunc();
}
else if (choice == 10) {
word6 = "søt";
dispFunc();
}
else if (choice == 11) {
word6 = "skummel";
dispFunc();
}
}