Code0Em / lingua-sonnet

A web application to search word definitions, pronunciations and usage in poetry
MIT License
0 stars 1 forks source link

JS: Function to check if random poem (from Poetry API) contains user's word. #17

Closed Code0Em closed 9 months ago

Code0Em commented 9 months ago

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.

Code0Em commented 9 months ago

Still to do: Grab user's word from HTML and incorporate this into this function.