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.
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.
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.
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.