//Promise
function app(num,data){
}
if you want to execute yourself again after a successful call
var data=[...]
//data.length=3
app(0)
.then(function(res){
console.log(res)
return app(1)
})
.then(function(res){
console.log(res)
return app(2)
});
if the number of times of execution is not sure how to implement it, it has been executed for 3 times, and the length of the returned data data is uncertain.