2 行目でエラーが発生するのはなぜですか?
[0,1,2].forEach(function(x) { console.log(x) }); // prints 0, 1, 2
[0,1,2].forEach(console.log); // throws "TypeError: Illegal invocation"
2 行目でエラーが発生するのはなぜですか?
[0,1,2].forEach(function(x) { console.log(x) }); // prints 0, 1, 2
[0,1,2].forEach(console.log); // throws "TypeError: Illegal invocation"