-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathscript.js
More file actions
26 lines (23 loc) · 779 Bytes
/
script.js
File metadata and controls
26 lines (23 loc) · 779 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
// Mood Ring 💍
// Codédex
const stone = document.getElementById('stone');
const randomNumber = Math.floor(Math.random() * 10) + 1;
if (randomNumber === 1) {
stone.style.backgroundColor = "red";
} else if (randomNumber === 2) {
stone.style.backgroundColor = "orange";
} else if (randomNumber === 3) {
stone.style.backgroundColor = "yellow";
} else if (randomNumber === 4) {
stone.style.backgroundColor = "green";
} else if (randomNumber === 5) {
stone.style.backgroundColor = "blue";
} else if (randomNumber === 6) {
stone.style.backgroundColor = "#4169e1";
} else if (randomNumber === 7) {
stone.style.backgroundColor = "#00008b";
} else if (randomNumber === 8) {
stone.style.backgroundColor = "purple";
} else {
stone.style.backgroundColor = "black";
}