i have logic with promise with while it do promsie with name if it found it I want that the promise will call again with new name ( name + index) The problem after the first promise it called it didn't continue to the next while and return from the function. What is wring ?
var result = true;
var that = this;
var name = "testFoler";
while (result) {
var index = 0;
return that.context.doPromise(name).then(function(promiseResult) {
if (promiseResult === null){
return Q(name)
} else {
index++;
name = name + index
}
});
}