Answers for "async await return value"

-1

How to return values from async function

const axios = require('axios');
async function getData() {
    const data = await axios.get('https://jsonplaceholder.typicode.com/posts');
    return data;
}
console.log(getData());
Posted by: Guest on June-02-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language