Want to replicate a Random Meal Generator that I found online, but don't want to obviously copy the code

I want to know how would I go about finding an api that generates random food recipes.I don’t want to “cheat” by looking at this developers code to find the API

What do you suggest that I do?

Here is this link to the original code:


And here is to the link to my code so far that I am trying to replicate:


Update. My Api that i use isn’t generating any API data in the console.I am using AJAX. Here is my code.

const button=document.querySelector(".btn");
const recipe=document.querySelector('.recipe')

    let xhttp=new XMLHttpRequest();
        if(this.readyState==4 &&this.status==200){
            const data=JSON.parse(this.responseText);




I am getting undefined in the console each time.


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.