I simplified the code, it would have been too long; I have three functions; the first contains the value, an array called multi, to be brought into the third; the second is only an intermediary
how do i bring multi into the third function?
function updateScegliFilm(film) {
var url1 = "https://api.themovie.org/search/movie?api_key=" + key + "&query=" + film;
var multi = [];
fetch(url1)
.then(response => response.json())
.then(json => {
var idFilmElenco = json['id'];
var titleFilm = json['title'];
output = new Array(idFilmElenco, titleFilm);
multi.push(output);
return multi;
});
}
function gestioneElenco(output) {
output.forEach(film => {
tendina(film);
});
}
function tendina(film, multi) {
updateScegliFilm(film, multi);
alert(multi);
}