Why doesn't console.log work when passed as a parameter to forEach?

前端 未结 4 1983
清歌不尽
清歌不尽 2020-11-27 05:24

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 TypeErro         


        
4条回答
提交回复
热议问题