i have this code
async function wait_till_loaded() {
console.log("wait_till_loaded start")
if (start_game_bool == false)
{
console.log("loading")
await new Promise(r => setTimeout(r, 2000));
}
if (start_game_bool == false)
{
console.log("loading 2 ")
await new Promise(r => setTimeout(r, 2000));
}
if (start_game_bool == false)
{
console.log("loading 3 ")
await new Promise(r => setTimeout(r, 2000));
}
console.log("wait_till_loaded end ")
}
wait_till_loaded(); console.log("aaaaaaa") console.log(start_game_bool) if (start_game_bool == true){start_game(); console.log("started game")}
this does print
wait_till_loaded end
but this doesnt
aaaaaaa
so it just never gets out of the async function even though it gets to the end.
why?