4 ms·
We can go one cleverer[1]: functions.forEach(Function.prototype.call, Function.prototype.call) this is approximately equivalent to functions.forEach(
by amptorn 9y ago
We can go one cleverer[1]:
functions.forEach(Function.prototype.call, Function.prototype.call)
this is approximately equivalent to
functions.forEach(f => f())
although in practice it's actually more like
functions.forEach((f, i, arr) => f.bind(i)(arr))
so let's hope `f` isn't too sensitive to the value of `this` or that `arr` parameter...
[1] https://zpao.com/posts/calling-an-array-of-functions-in-javascript/ https://zpao.com/posts/calling-an-array-of-functions-in-java...