Skip to content

Commit 0015e40

Browse files
replace pickFromArray with direct random selection from quotes array
1 parent 670779a commit 0015e40

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Sprint-3/quote-generator/quotes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ const quotes = [
492492

493493
// call pickFromArray with the quotes array to check you get a random quote
494494

495-
const randomQuote = pickFromArray(quotes);
495+
const randomQuote = quotes[Math.floor(Math.random()*quotes.length)];
496496

497497
const quote = document.getElementById("quote");
498498
quote.innerText = randomQuote.quote;
@@ -502,7 +502,7 @@ author.innerText = randomQuote.author;
502502

503503
const button = document.getElementById("new-quote");
504504
button.addEventListener("click", () => {
505-
const randomQuote = pickFromArray(quotes);
505+
const randomQuote =quotes[Math.floor(Math.random()*quotes.length)];
506506

507507
const quote = document.getElementById("quote");
508508
quote.innerText = randomQuote.quote;

0 commit comments

Comments
 (0)