Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A note on JavaScript Async/Await #102

Open
dvas0004 opened this issue Sep 25, 2019 · 0 comments
Open

A note on JavaScript Async/Await #102

dvas0004 opened this issue Sep 25, 2019 · 0 comments
Assignees

Comments

@dvas0004
Copy link
Owner

We can only await for an actual result from a promise within an async function, while the async function itself will always return a promise. For example:

const demo = async () => {
   const response = await Axios.get("http://example.com") 
   //"response" will contain the actual JS object
}

const p = demo() 
// "p" will contain a pending promise, NOT the actual data
@dvas0004 dvas0004 self-assigned this Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant