0

I have an array of objects which contain the keys author and quote. I take the values and print them on the website. I'm trying to prevent this from printing duplicates but I can't seem to wrap my head around it. Thanks for your help in advance.

this is the event listener for the button that generates the random quote

btn.addEventListener('click', () => {
    const randomQuote = quoteObject[Math.floor(Math.random()*quoteObject.length)];
    console.log(randomQuote);
    quote.textContent = randomQuote.quote;
    author.textContent = `-${randomQuote.author}`;
});
ajdin
  • 1
  • 1

0 Answers0