Resolving a Promise [object Promise]

I know this is old.

I am no expert, but…
I had a similar problem inside backend code. The “log” message was returning [{}] inside the logs. Then I realized that in fact it was returning a “object Promise”.

In my case, I think I solved it waiting for the promise to resolve BEFORE loggin the result.
So in your case, I would try:

  1. Make the function from which you are calling the getDiscount function an “async” function.
  2. Put an “await” before calling the getDiscount function:
const discount = await getDiscount(fee1, fee2, fee3).then(function (result)
{
    // Returns 20
    console.log("discount result inside function: " + result);
    return result
});
// Hopefully, it will return "20".
console.log("discount result outside function: " + discount) 
  1. Or… do not declare “getDiscount” async.