Inconsistent click events with random quote generator

Hey all, this is my first post here. I’ve made it through to the intermediate projects and built my random quote generator as a simple app with a relatively rudimentary implementation of modules. All is well, except sometimes when I click for a new quote or click to share, nothing happens. Does anyone know why that might be? If you care to see it, it’s posted here:
https://alightedlamp.github.io/fcc-quote-generator/

And the code is here:
https://github.com/alightedlamp/fcc-quote-generator

Any feedback or thoughts would be much appreciated!

Your random number computation doesn’t have guard against repeat. Hence, sometimes it will give same number on consecutive trials which creates illusion of malfunction.
Click event handler is attached to ‘a’ tag. As a result, clicking outside of the icon doesn’t trigger any event.

Thanks! I had noticed that there was the possibility of repeats and the next thing I wanted to do was to prevent that possibility, but didn’t realize that would be related to a click event in this way. I thought it was a different problem since I could generate a new quote, then click the twitter share button and it not respond.

Hi there,
I also thought at first that there was a problem with the button, but than realized that my Math.random() was actually giving me the same number again. Since I only added 3 quotes to my array, that happens a lot.

I tried to write a function that would not repeat the last used random number (once!) and it worked fine. Every click gives me a different number. As soon as I integrate it with the whole “Random Quote Machine” code, it stopped preventing the repeated random number/same quote.

Can someone tell my why?

Here are my pens:

Random Number Different From Last One Function:

Random Quote Generator Array No Repeat: