Carrying an array from an AJAX call into an additional, nested AJAX Call

Using the Rick & Morty API to create a website that, given x characters, will return episodes that contain all x characters.

   $.ajax(url1)
    .then ((info1) => {
        char1Episodes = info1.results[0].episode
        
    })

this stores the array of episodes for a given character into a variable char1Episodes….how do I then take that into another AJAX call to compare it against an array of the second character’s episodes to check for any duplicates using a for loop, thus signifying episodes they share?