iife asynchronous call code example
Example 1: async iife
(async () => {
// code goes here
})();
Example 2: await async iife javascript
const timeouttt = () => {
return new Promise(resolve => {
setTimeout(() => {
console.log('hey');
resolve('heyyy');
}, 1000);
});
};
const hello5 = async () => {
console.log('hi iqbal');
let y = await (async function () {
let x = await timeouttt();
console.log(x);
console.log('hola');
return 5;
})();
console.log(y);
console.log('vola');
};
hello5()