This question has already been answered:
Friends, please tell the newcomer how to return the value of out'a? in fact, there are names of twich channels; this function would be desirable if it would return an array of json objects obtained from the given channels names
function getMasApi(mas) { var out = []; mas.forEach(function(el, i) { $.getJSON(api + el, function(json) { //console.log(json); out.push(json); //console.log(out); }); }); console.log(out); return out; }; var channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"]; let api = "https://wind-bow.glitch.me/twitch-api/channels/"; getMasApi(channels); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>