I make a adjust seat website, which increase my understanding of javascript.
I learned how to delate the loop
1 | function delay(ms) { |
and
1 | for (let i = 0; i < 10; i++) { |
Once, I make a sleep function, but I forget to return the Promise data.
Which let me impress. And I find that no need to change asyncfunction.
1 | function sleep(ms){ |
Because it is no use to add async to sleep function, only add async to your operative function, adding await sleep(delate) just take effect. Otherwise, your operative wouldn’t wait the sleep function, running next code directly.