1

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
                }
            });

       }
user1365697
  • 5,819
  • 15
  • 60
  • 96

1 Answers1

0

Well you are passing "reuslt" as parameter which certainly does not exist.