Created
July 13, 2022 11:41
-
-
Save tristancamejo/c113f9b5738028ec1c5d6a846003e9a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const testArray: number[] = []; | |
for (let i = 0; i < 100; i++) { | |
testArray.push(i); | |
} | |
for (const { index, element } of testArray.map((element, index) => ({ | |
index, | |
element, | |
}))) { | |
if (index % 5 === 0 && index !== 0) { | |
console.log(`Taking a break... ${index.toString()}/ | |
${testArray.length.toString()}, | |
)}`); | |
await new Promise((resolve) => setTimeout(resolve, 5000)); | |
} | |
console.log(`up to ${index}`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment