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

243
Views
Accessing fetched data outside the fetch() function scope without being returned a pending promise

How would I go about accessing the fetched data from a fetch() function without being returned a Promise {<pending>}?

function GetWords() {
    fetch("https://random-word-api.herokuapp.com/word?number=100")
    .then(response => response.json()).then((word => {
    return word
 }));
}

async function LoadWords() {
    const words = await GetWords()
    return words
}

words = LoadWords()

console.log(words);

console.log(words) returns a Promise {<pending>} instead of the actual data which is expected to be an array of words

Expected output example:

['regelated', 'pneumatophores', 'uppers', 'hexachlorethane', 'veloutes', 'hove', 'locomotives', 'vitalist', 'reascending', 'claustrophobias']

What can I change to have such output?

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!