-
Notifications
You must be signed in to change notification settings - Fork 0
/
dom.js
26 lines (21 loc) · 838 Bytes
/
dom.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
// Event Handlers and Events
let fortunes = ["A beautiful, smart, and loving person will be coming into your life.",
"A fresh start will put you on your way.",
"A golden egg of opportunity falls into your lap this month.",
"A smile is your personal welcome mat.",
"All your hard work will soon pay off."
]
let button = document.getElementById('secretButton');
let fortune = document.getElementById('secretMessage');
function fortuneSelector(){
let randomFortune = Math.floor(Math.random() * fortunes.length);
return fortunes[randomFortune];
}
function showMessage(){
fortune.innerHTML = fortuneSelector();
button.innerHTML = "Click to see secret message";
button.style.cursor = "default";
//add your code here
// button.removeEventListener('click', showFortune);
}
button.addEventListener('click', showMessage);