Fun with API

Press the button for an inspirational quote! Quotes provided from user SergeyWebPro on the freeCodeCamp forum


Under the hood: Regular fetch request wrapped in an async function. Returns a large array from the endpoint. Each index contains a quote and its author. Every time the "Inspire Me" button is pressed, only one quote is displayed in the box through the use of a random number generator. A random index from the array is selected.

Press the button to generate a suggestion with the help of The Bored API! (www.boredapi.com)


Under the hood: This API is free like the other, and comes with plenty of useful suggestions. I did not wrap the fetch request in an async function here. While this prevents the use of using the "await" keyword, this does not seem to create any real performance issues or conflicts on the page in this case.