Closed eljavero closed 11 months ago
I believe you may have figured it out yourself by now.
The Promise.then
is called asynchronously and your console.log(x)
is executed beforehand.
Either use the result inside the then
callback
x = promise.then(
result =>{
console.log(result);
return (result);
}
);
OR use async await
syntax
x = await promise;
console.log (x);
Hi everyone, sorry if I ask this question here, but tried a lot of things and wasn't able to solve this problem.
I am trying to use the results of the decision table outside the scope of the async function. like this:
always got this:
Promise { <pending> }
rather than the json object I guess is my ignorance about promises and async functions. Any help would be much appreciated. Thank you.