function aa () {
(async () => {
for (let i = 0; i < 10; iPP) {
console.log(i, "iiiii")
await new Promise((resolve1, reject1) => {
(async () => {
for (let j = 0; j < 20; jPP) {
await new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, 5000)
})
console.log(i, j)
}
resolve1()
})(this)
})
}
})(this)
}
execute aa () for five seconds before executing aa ()
the above two loops are executed when clicked. If I click 5 times, then for will execute the previous 4 times if it is not finished, in addition to executing the last click loop. Could you tell me how to skip the previous loop and directly execute it for the last time?