Skip to content

Commit 6aade2f

Browse files
author
Ogbemi mene
committed
change to put my function above the instruction
1 parent b79d1b6 commit 6aade2f

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

‎Sprint-3/quote-generator/quotes.js‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
// call pickFromArray with the quotes array to check you get a random quote
2+
function displayRandomQuote() {
3+
const quoteP = document.getElementById("quote");
4+
const authorP = document.getElementById("author");
5+
6+
const selectedQuote = pickFromArray(quotes);
7+
8+
quoteP.textContent = selectedQuote.quote;
9+
authorP.textContent = selectedQuote.author;
10+
}
11+
12+
// Setup event listener and display initial quote on load
13+
window.addEventListener("DOMContentLoaded", () => {
14+
displayRandomQuote();
15+
16+
const newQuoteBtn = document.getElementById("new-quote");
17+
newQuoteBtn.addEventListener("click", displayRandomQuote);
18+
});
19+
120
// DO NOT EDIT BELOW HERE
221

322
// pickFromArray is a function which will return one item, at
@@ -489,22 +508,3 @@ const quotes = [
489508
author: "Zig Ziglar",
490509
},
491510
];
492-
493-
// call pickFromArray with the quotes array to check you get a random quote
494-
function displayRandomQuote() {
495-
const quoteP = document.getElementById("quote");
496-
const authorP = document.getElementById("author");
497-
498-
const selectedQuote = pickFromArray(quotes);
499-
500-
quoteP.textContent = selectedQuote.quote;
501-
authorP.textContent = selectedQuote.author;
502-
}
503-
504-
// Setup event listener and display initial quote on load
505-
window.addEventListener("DOMContentLoaded", () => {
506-
displayRandomQuote();
507-
508-
const newQuoteBtn = document.getElementById("new-quote");
509-
newQuoteBtn.addEventListener("click", displayRandomQuote);
510-
});

0 commit comments

Comments
 (0)