Following is the code in which I am getting Cannot read property 'forEach' of undefined.
const print2 = function(x, y) {
console.log(x*y)
}
[1,2,3,4].forEach( x => print2(x, 20) )
Let me know what I am doing wrong here, though if I do -
function print2(x, y) {
console.log(x*y)
}
[1,2,3,4].forEach( x => print2(x, 20) )
this is working fine.
