-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquotes.js
53 lines (50 loc) · 1.66 KB
/
quotes.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
var arrayOfQuotes = [
{
"author" : "Jim Rohn",
"quote": "Beware of what you become in pursuit of what you want."
},
{
"author": "Epictetus",
"quote": "It's not just what happens to you,but how you react to it that matters."
},
{
"author": "Frank Sinatra",
"quote": "The best revenge is massive success."
},
{
"author":"Wayne Gretzy",
"quote": "You miss 100% of the shots you dopn't take."
},
{
"author": "Nelson Mandela",
"quote":"Resentment is like drinking poison and waiting for your enemies to die."
},
{
"author":"Confucius",
"quote":"Silence is a true friend who never betrays."
},
{
"author":"Elbert Habbard",
"quote": "Do not take life too seriously. You will not get out alive."
},
{
"author":"Lyndon B.Johnson",
"quote":"Yesterday is not ours to recover,but tommorrow is ours to win or lose."
},
{
"author":"Henrik Ibsen",
"quote":"A thousand words can not leave the same deep impression as a single deed."
},
{
"author":"Katherine Pearson",
"quote":"A dream without a plan is nothing more than a wish."
}
]
function randomSelector(arrayLength) {
return Math.floor(Math.random() * arrayLength);
}
function generateQuote(){
var randomNumber = randomSelector(arrayOfQuotes.length);
document.getElementById("quoteOutput").innerHTML = '""' + arrayOfQuotes[randomNumber].quote + '"';
document.getElementById("authorOutput").innerHTML = "-" + arrayOfQuotes[randomNumber].author;
}