Promise within while loop won't run - causing infinite loop
问题 I am trying to run a Promise within a while loop. The code after the promise (in the .then) will eventually break the while loop. However, the promise never runs. The while loop just keeps running infinitely without triggering the promise. Why is this? Is it impossible to use a promise in a while loop? A simplified version of code is below while(relevantRefundRequests.length >= waitList[0].quantity){ stripe.paymentIntents.create({ }) .then(data => { ***code that will break while loop }) } 回答1