-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
35 lines (31 loc) · 1.13 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
const facts = [
"I once met Michel Roux",
"I enjoy coding and cooking",
"I am 22",
"I am from Bristol",
"I used to work in Hospitality",
"My first job was at Showcase Cinema De Lux",
"I play Magic the Gathering",
"I have met David Attenburough",
"I have done a few 5K runs",
"I was a member of a martial arts club for 10 years",
"I want to go to travel more",
"I used to be an Assistant Manager in a hotel and a cinema",
"I am a Personal License holder",
"I finished GCSE computing with 1/2 a mark away from an A*",
"I have successfully completed a 12 week bootcamp with _Nology",
"I have worked fully remote for 5 weeks of my _Nology course",
"I won a tech award whilst on my course for completing a challenge in the least amount of code"
];
const totalFacts = facts.length;
const printFact = () => {
const randomIndex = Math.floor(Math.random() * totalFacts);
const randomFact = facts[randomIndex];
return (
console.log("I am Printing"),
(document.getElementById("fact").innerHTML = ` ${randomFact}`)
);
};
document
.getElementById("randomBtn")
.addEventListener("click", () => printFact());