by nilved · 11y ago · 0 comments
n.forEach(console.log.bind(console));
I don't think there's any reason for this library to exist after you understand `this` semantics but I may be missing something.e: was, in fact, missing something. Apologies for the disparaging comment, see replies.
[1, 2, 3].forEach(console.log.bind(console));
> 1 0 [1, 2, 3]
> 2 1 [1, 2, 3]
> 3 2 [1, 2, 3] n.forEach(console.log.bind(console));
forEach is passing console all of its callback arguments, resulting in logging of keys, values, and array.EDIT: Forgot array