immediately invoked async function code example
Example 1: async iife
(async () => {
})();
Example 2: async await iife
(async () => {
})();
Example 3: 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()