-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
51 lines (45 loc) · 1.3 KB
/
script.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
function changeTheme() {
let body = document.querySelector("body");
// body.classList.toggle("dark");
if (body.classList.contains("dark")) {
body.classList.remove("dark");
} else {
body.classList.add("dark");
}
}
let themeButton = document.querySelector(".theme-button");
themeButton.addEventListener("click", changeTheme);
function joinClub() {
alert("Welcome! We are so happy that you want to join our club!");
let name = prompt("What is your name?");
let email = prompt("What is your email?");
let games = prompt("Have you played videogames before?");
games = games.toLowerCase().trim();
if (games === "no") {
alert(
"Hello " +
name +
"! You will play new games with us! We'll be in touch through your email " +
email +
" 👾"
);
} else if (games === "yes") {
alert(
"Hello " +
name +
"! You sure have some videogames you can recommend to us! We'll be in touch through your email " +
email +
" 👾"
);
} else {
alert(
"Hello " +
name +
"! Welcome to the gamer community! We'll be in touch through your email " +
email +
" 👾"
);
}
}
let joinButton = document.querySelector(".join-community");
joinButton.addEventListener("click", joinClub);