The problem of variables in for Loop in promise,then and catch

define a variable redBorderIndex=1, calls the method of promise type with for loop, execute the then variable PP, when executing catch, print the variable, but the print variable does increase when then is executed, and the variable is still 1 when catch is executed. The specific code is as follows:

Mar.16,2021

is it possible that the promise returned first made a mistake, so you went catch , at this time redBorderIndex or 1 , and then promise did not report wrong, so if you go redBorderIndexPP , you can add a debugger to both then and catch .

Menu