So i have a IIFE as such in my code with a while loop inide. When the loop finished the console.log("Hey") executes but it doesnt come out of the function. Can anyone tell me whats going on?
(function () {
return new Promise(async resolve => {
while (i <= fcount) {
i++;
//some code
}
console.log("Hey");
resolve("done");
})
}());