Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

return data from async function using async await

async function getData() {
  return await axios.get('https://jsonplaceholder.typicode.com/posts');
}

(async () => {
  console.log(await getData())
})()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #return #data #async #function #async #await
ADD COMMENT
Topic
Name
4+1 =