Reading You don't know JS series and got confused with the following snippet
function spread(fn) {
return Function.apply.bind( fn, null ); // How does this work???
}
Promise.all(
foo( 10, 20 ) // Returns an array of promises
)
.then(
spread( function(x,y){
console.log( x, y ); // 200 599
} )
)
Trying to understand how passing a function to bind will change its arguments to an array? Note, we are binding a function to apply here and as a result we get substituted apply function for a function with arguments...