I have a function that calls from a Promise. The mainFunc() supposes to return the value true. However, It always is a promise.
function mainFunc(){
var test = promiseFunc().then(function(result){
return result;
})
alert(test); // should be true value
return test;
}
function promiseFunc(){
return new Promise(function(resolve, reject){
alert(1);
resolve(true);
})
}
mainFunc();
Do you know how to return the value from a Promise function in the right way?
You can take a look at the code here: https://jsfiddle.net/vxtmumqz/6/
Thanks,