8
rated 0 times
[
13]
[
5]
/ answers: 1 / hits: 34680
/ 4 Years ago, thu, may 28, 2020, 12:00:00
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.
More From » node.js