1
有了這些嵌套函數:爲什麼Promise.all不一定會兌現承諾?
Promise.all(mapDomains(x => x.close()))
我想過將它們組成:
compose(Promise.all, mapDomains)(x => x.close())
但是上面的代碼失敗,而不結合Promise.all本身。這是修復:
let f1 = Promise.all.bind(Promise)
compose(f1, mapDomains)(x => x.close())
雖然我知道這是所有關於this
關鍵字在Javascript中是如何工作的,我想知道:爲什麼不.all
一定到自己了嗎?那有什麼價值嗎?