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

异步编程-Promise 题目 5 - 6 #143

Open
leslie1943 opened this issue Jan 13, 2021 · 0 comments
Open

异步编程-Promise 题目 5 - 6 #143

leslie1943 opened this issue Jan 13, 2021 · 0 comments

Comments

@leslie1943
Copy link
Owner

Promise 5 - 6

async function async1 () {
  console.log('async1 start');
  await new Promise(resolve => {
    console.log('promise1')
    resolve('promise1 resolve')
  }).then(res => console.log(res))
  console.log('async1 success');
  return 'async1 end'
}
console.log('srcipt start')
async1().then(res => console.log(res))
console.log('srcipt end')

/**
  srcipt start
  async1 start
  promise1
  srcipt end
  promise1 resolve
  async1 success
  async1 end
 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant