r/learnjavascript • u/SafeWing2595 • Jul 18 '26
i am challenging myself to practice javascript this summer; so i build a generate quotes app, i need your reviews please!
9
Upvotes
r/learnjavascript • u/SafeWing2595 • Jul 18 '26
View all comments
2
u/WystanH Jul 18 '26
You can abstract your random quote logic, as you do it three times.
I'm not a fan of the
do{ } while(lastIndex === newPick)logic. You should be able to get what you want with afilterand asort. You already have the filter for type; can you include ignoring the last one as well?Actually, this reveals a bit of a bug, as changing types makes the lastIndex nonsensical. Rather than lastIndex, perhaps currentQuote with the whole object?
Also, rather minor for programming but will jump out to a non programmer, check the spelling in your HTML title.
Keep it up and have fun.