stevekane / promise-it-wont-hurt

A Workshopper module that teaches you to use promises in javascript
737 stars 219 forks source link

lesson #4 #136

Open isomorphisms opened 7 years ago

isomorphisms commented 7 years ago

what exactly is the bug in

(user,callback) => {
  if (user) { callback(null,user) ; }
  return callback( "No user found", null)
  }

?

addaleax commented 7 years ago

@isomorphisms I think you want to return; inside the if block as well, otherwise you first run the callback with callback(null, user); and then with callback( "No user found", null);?