This is just out of curiosity, but do any of you have an idea why this code won't work?
CASE 1: If I don't put semicolon after console.log()
, the code doesn't work.
console.log('foo')
[3, 2, 1].forEach( v => console.log(v) )
Output of case1:
foo
TypeError: Cannot read property '1' of undefined
CASE 2: If I don put semicolon after console.log();
, the code works fine.
console.log('foo');
[3, 2, 1].forEach( v => console.log(v) )
Output of case2:
foo
3
2
1