Quote Machine App Feedback

I attempted to use react for this project but had a difficult time implementing animations so i used JQuery instead.
Any feedback would be awesome. Thanks in advance.
Oh, here’s the link btw https://codepen.io/onecastell/full/JwvjXo

I like the design, very nice.

One thing I did notice is the logic of making sure the quotes do not repeat is not working. It’s just the likelihood of seeing it is pretty small. If you change the array so you only have 2 quotes you will see it.

if (index == curIndex) {
  //Regenerate index if same as current
  index = Math.floor(Math.random() * quotes.length);

You would need to recheck index == curIndex again after setting it in the if statement, because it can be the same again.

Instead, one option would be to just call the fetchQuote function inside the if statement.

if (index == curIndex) {
  // Re-run fetchQuote if index is the same as curIndex
  // When we return back to the call site we need to return out of the function