-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
59 lines (47 loc) · 1.48 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
52
53
54
55
56
57
58
59
//Model
// Variables
let btn = document.querySelector('#new-quote');
const quotes = [
{
quote: `The journey of a thousand miles begins with one step.`,
person: `Lao Tzu`
},
{
quote: `That which does not kill us makes us stronger.`,
person: `Friedrich Nietzsche`
},
{
quote: `Life is what happens when you’re busy making other plans..`,
person: `John Lennon`
},
{
quote: `When the going gets tough, the tough get going.`,
person: `Joe Kennedy`
},
{
quote: `You must be the change you wish to see in the world.`,
person: `Mahatma Gandhi`
},
{
quote: `Twenty years from now you will be more disappointed by the things that you didn’t do than by the ones you did do.`,
person: `Mark Twain`
},
{
quote: `Life is like a box of chocolates. You never know what you’re going to get.`,
person: `Forest Gump`
},
{
quote: `Don’t be afraid to give up the good to go for the great.`,
person: `John D. Rockefeller`
},
];
// View
function change(){
let random = Math.floor(Math.random() * quotes.length);
let quote = document.querySelector('.quote');
let person = document.querySelector('.person');
quote.innerText = quotes[random].quote;
person.innerText = quotes[random].person;
}
// Controller
btn.addEventListener('click', change);