ts sleep function code example
Example: typescript sleep
function delay(ms: number) {
return new Promise( resolve => setTimeout(resolve, ms) );
}
await delay(300);
function delay(ms: number) {
return new Promise( resolve => setTimeout(resolve, ms) );
}
await delay(300);