how to use delay function in js code example
Example 1: js add delay
await new Promise(resolve => setTimeout(resolve, 1000));
Example 2: javascript sleep settimeout
setTimeout(() => { console.log("World!"); }, 2000);
await new Promise(resolve => setTimeout(resolve, 1000));
setTimeout(() => { console.log("World!"); }, 2000);