Is there some way to rewrite this in less lines of code, by making it dynamic instead of doing multiple similar calls with different indexes?
var input = getInput();
var URL = getEndpointURL();
var results = [];
$.when(
$.getJSON(URL+input[0], function (data,status) {
results[0] = data;
}),
$.getJSON(URL+input[1], function (data,status) {
results[1] = data;
}),
$.getJSON(URL+input[2], function (data,status) {
results[2] = data;
}),
$.getJSON(URL+input[3], function (data,status) {
results[3] = data;
}),
$.getJSON(URL+input[4], function (data,status) {
results[4] = data;
}),
).then(function() {
processResults(results);
});