1. 6
  1.  

  2. 3

    The initial puzzle doesn’t really have anything to do with promises as far as I can tell, but rather understanding higher-order functions as they are in JavaScript. Are promises the main place someone will actually use higher order functions in JS? For example, in Ocaml the promises-like library is very natural because most Ocaml developers spend most of their time passing functions around in other APIs.

    1. 1

      No, promise usage is gradually increasing, but the vast majority of JS code uses some type of non-promise callback pattern. (DOM event handlers, Node-style “everything is a callback”, etc.)

      I agree that the initial puzzle doesn’t seem related to promises. However, my perception is that there is a lot of confusion over promises among “average” JS developers, since everyone is used to non-composable callbacks.