Not sure if im just being dumb but is there any way other than possibly using some horrific while loop at the end of f() to convert f() into a sync function. I cant change someFun() i.e make it async function someFun() but i could add await to f() call if needed. So basically i want f() to return data that is obtained in the callback (imagine http call or something) I can do whatever i like in f() e.g. Promises etc but someFun can not change to be async function someFun()
<script>
  function f(){
    var data;
    var callback = function(){
      data = {name:"bob"};
      console.log("did some stuff");
    }
    setTimeout(callback, 100);
    
    return data;     
  }
  
  function someFunc(){
    console.log('start')
    var data = f();
    console.log('end', data)
  }
  someFunc();
</script> 
