Skip to content

Instantly share code, notes, and snippets.

@jasonweng
Created March 14, 2018 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonweng/2a3e7e7b7c2e9433ee496d8dad70e226 to your computer and use it in GitHub Desktop.
Save jasonweng/2a3e7e7b7c2e9433ee496d8dad70e226 to your computer and use it in GitHub Desktop.
Front end interview tests
var p1=new Promise(resolve => {
console.log(1)
resolve(2)
})
var p2=new Promise(resolve => {
console.log(3)
resolve(p1)
})
p1.then(re => {
console.log(re)
})
p2.then(re => {
console.log(re)
})
/*===============================
1
3
2
2
Promise {<resolved>: undefined}
=================================*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment