Skip to content

Commit 144ba1d

Browse files
committed
quote generator function implemented
1 parent 6e2c774 commit 144ba1d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Sprint-3/quote-generator/quotes.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
function getRandomQuote() {
2+
const randomQuote = Math.floor(Math.random() * quotes.length);
3+
return quotes[randomQuote];
4+
}
5+
function showQuote() {
6+
const quote = pickFromArray(quotes);
7+
document.getElementById("quote").innerText = `"${quote.quote}"`;
8+
document.getElementById("author").innerText = `- ${quote.author}`;
9+
}
10+
window.onload = showQuote;
11+
document.getElementById("new-quote").addEventListener("click", showQuote);
12+
113
// DO NOT EDIT BELOW HERE
214

315
// pickFromArray is a function which will return one item, at

0 commit comments

Comments
 (0)