I would like to grab random sentences from Free Dictionary API and add them based on time on a web page.
The basic idea is like this:
var randomSentence = get a randomSentence from api.dictionaryapi.dev/api;
setTimeout(function() {
$(".random-sentence").append(randomSentence);
}, 2000);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="random-sentence"></div>
Here is some information about the API: https://github.com/meetDeveloper/freeDictionaryAPI
How can I get sentences randomly? Would be very thankful for help!
Sorry if I'm wrong but I don't see a way to get sentences from freeDictionaryAPI unless it's in the returned JSON of whatever word you get the definition of.
So the first method you could take that I thought of from the top of my head is just to get a random English word and use that in the API, and return the word's example sentence.