typscript how to wait in function code example
Example: javascript async delay
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
(async () => {
console.log('1');
await delay(1000);
console.log('2');
})();
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
(async () => {
console.log('1');
await delay(1000);
console.log('2');
})();