Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

278
Views
Javascript/React How to return data from a promise?

I'm pulling prices from an api, and I have a function where I pull the prices, and return a formatted version of them.

          const res = await CoinGeckoClient.coins.fetch(farm.quoteToken.name)
          // console.log(res)
          const data = await res.data
          const unformatted_price = new BigNumber(data.market_data.current_price.usd).toString()
          // console.log(earn_price)
          const formatted_price = parseFloat(unformatted_price).toLocaleString(undefined, {
            minimumSignificantDigits: 3,
          })

          return formatted_price
        }

Inside of the function, if I console.log(formatted_price) it gives me the result I'm looking for. However when I return it to use when calling the function, I get a pending fulfilled promise. I'm trying to get the promise result as shown.

Sort of confused on how it's pending, but it's fulfilled with a result? I've tried .then() and everything but I continue to get Promise {}. Any help would be appreciated!

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!