for (leti = 0; i < 10; i++) { // Parse the page and wait for 1 second before parsing the next page constpageData = awaitparsePage(i) awaitdelay(1000) }
// You can also use alias sleep instead of delay awaitsleep(1000)
Parameters
ms: number
The number of milliseconds to delay execution.
Returns Promise<void>
A promise that resolves after the specified delay.
Throws
Thrown if the input is not a number or if the number is negative.
Pauses execution for a specified number of milliseconds.
Example