Feedback -- Random Quote Machine (First time working with JavaScript on a project!)

I finally made the random quote generator in 15 lines of JavaScript! (A great accomplishment for me, as I overcame my fear of JavaScript because of this project!)
Link to the codepen –
Feedback and suggestions are always welcome!


I have a suggestion which will make your Quote Generator more efficient at displaying the quotes.

Instead of calling the API each time the Next button is clicked and selecting a random quote from the array of quotes, why not only call the API only once since it is the same quotes each time anyway?

Call the API once the page loads and store the array of quotes in a variable, so when you click on the Next button, you only have to load a random quote from the array each time.’’

Also, you should consider making your project responsive, so that it looks good on mobile devices. You are using fixed widths.

Iphone 8

Consider changing the width property of .main to 50%

Consider changing the margin-left property of .tweet-quote to 50%

Consider completely removing the width:400px property from .author

This will give a similar look to the quotes no matter the device screen width.

1 Like