158
rated 0 times
[
162]
[
4]
/ answers: 1 / hits: 15679
/ 12 Years ago, fri, march 9, 2012, 12:00:00
This is just out of curiosity, but do any of you have an idea why this code won't work?
[1, 2, 3, 4, 5].forEach(console.log);
// Prints 'Uncaught TypeError: Illegal invocation' in Chrome
On the other hand, this seems to work fine:
[1, 2, 3, 4, 5].forEach(function(n) { console.log(n) });
So... ?
More From » arrays