Skip to content

Instantly share code, notes, and snippets.

@getify
Last active August 29, 2015 13:59
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 getify/10518012 to your computer and use it in GitHub Desktop.
Save getify/10518012 to your computer and use it in GitHub Desktop.
new JS employment quiz
// Without running this code, state what the order of printed numbers will be.
console.log("1");
(new Promise(function(resolve){
console.log("2");
resolve();
console.log("3");
}))
.then(function(){
console.log("4");
var p = new Promise(function(resolve){
console.log("5");
resolve();
console.log("6");
});
console.log("7");
return p;
})
.then(function(){
console.log("8");
});
console.log("9");
@AGoblinKing
Copy link

console.log("2");
resolve();
console.log("3");

Running code after resolving a promise is super odd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment