Skip to content

Commit 9cb0b72

Browse files
author
Pretty Taruvinga
committed
display random quotes and update on button click
- added quote array - implemented random selection logic - updated DOM with quote and author - fixed execution order and property naming issues
1 parent 5d99247 commit 9cb0b72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sprint-3/quote-generator/quotes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ function showQuote() {
66
const index = Math.floor(Math.random() * quotes.length);
77
const randomQuote = quotes[index];
88

9-
quoteElement.innerText = randomQuote.quote;
10-
authorElement.innerText = randomQuote.author;
9+
quoteElement.textContent = randomQuote.quote;
10+
authorElement.textContent = randomQuote.author;
1111
}
1212

1313
button.addEventListener("click", showQuote);
14-
document.addEventListener("DOMContentLoaded", showQuote);
1514

1615
// DO NOT EDIT BELOW HERE
1716

@@ -506,3 +505,4 @@ const quotes = [
506505
];
507506

508507
// call pickFromArray with the quotes array to check you get a random quote
508+
showQuote();

0 commit comments

Comments
 (0)