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?