Can someone please explain how the function getQuotes is operating?
I have finished the task and completed all requirements as I made my own array with quotes that I know. However, I want to be able to understand how they are using this getQuotes function through API to get proper random quotes and not just the ones I feel like writing down. This way I could do it more efficiently in the future.
here is the code they use to get random quotes.
function getQuotes() { return $.ajax({ headers: { Accept: 'application/json' }, url: 'https://gist.githubusercontent.com/camperbot/5a022b72e96c4c9585c32bf6a75f62d9/raw/e3c6895ce42069f0ee7e991229064f167fe8ccdc/quotes.json', success: function (jsonQuotes) { if (typeof jsonQuotes === 'string') { quotesData = JSON.parse(jsonQuotes); console.log('quotesData'); console.log(quotesData); } } }); }
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.3 Safari/605.1.15
.
Challenge: Build a Random Quote Machine
Link to the challenge: