i have a function , i need to delay its return until a value is set (by calling another function call_api
basically i need to wait for second function result to be able to return the first function result )
here is what ti got
function getList(s, p)
{
var output = false ;
call_api(s , p , function(result){
console.log(result);
output = result;
})
while (output == false )
{
1 ;
}
return output ;
}
but it wont work while somehow is messing thing up is there a way to solve this ?
ps : i know about promise / async function but i cant use them (its a test i ant use them in the test )