Skip to content

Commit 31fcc7d

Browse files
Add functionality to display a random quote on page load
1 parent df37abd commit 31fcc7d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sprint-3/quote-generator/quotes.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function pickFromArray(choices) {
2020
return choices[Math.floor(Math.random() * choices.length)];
2121
}
2222

23+
24+
2325
// A list of quotes you can use in your app.
2426
// DO NOT modify this array, otherwise the tests may break!
2527
const quotes = [
@@ -491,3 +493,10 @@ const quotes = [
491493
];
492494

493495
// call pickFromArray with the quotes array to check you get a random quote
496+
497+
//window.addEventListener("load",pickFromArray(quotes))
498+
const randomQuote = pickFromArray(quotes);
499+
const quote=document.getElementById("quote")
500+
const author=document.getElementById("author")
501+
quote.innerText=randomQuote.quote
502+
author.innerText=randomQuote.author

0 commit comments

Comments
 (0)