using promise to delay code code example
Example 1: js add delay with promises
await new Promise(resolve => setTimeout(resolve, 1000));
Example 2: wait for promise javascript
const userCount = await getUserCount();
console.log(userCount); // 12345