Promises. Use them

At their most basic, promises are a bit like event listeners except:

  • A promise can only succeed or fail once. It cannot succeed or fail twice, neither can it switch from success to failure or vice versa
  • If a promise has succeeded or failed and you later add a success/failure callback, the correct callback will be called, even though the event took place earlier This is extremely useful for async success/failure, because you're less interested in the exact time something became available, and more interested in reacting to the outcome

http://www.html5rocks.com/en/tutorials/es6/promises/

Promises will save you from the Pyramid of Dooom

Callbacks