Why does the second line throw an error?
[0,1,2].forEach(function(x) { console.log(x) }); // prints 0, 1, 2
[0,1,2].forEach(console.log); // throws "TypeError: Illegal invocation"
Why does the second line throw an error?
[0,1,2].forEach(function(x) { console.log(x) }); // prints 0, 1, 2
[0,1,2].forEach(console.log); // throws "TypeError: Illegal invocation"