Create a function which checks if the random poem (from the API) contains the user’s word. If it does, the poem is displayed on the page. If it doesn’t, another random poem is generated (i.e. the fetch function is called again). Create variable to keep count of fetch function calls. Call fetch function up to ten times; after which an error message (e.g. “Sorry, we can’t find a poem right now”) is displayed.
Create a function which checks if the random poem (from the API) contains the user’s word. If it does, the poem is displayed on the page. If it doesn’t, another random poem is generated (i.e. the fetch function is called again). Create variable to keep count of fetch function calls. Call fetch function up to ten times; after which an error message (e.g. “Sorry, we can’t find a poem right now”) is displayed.