what happens if we use return in forEach method code example
Example: what foreach method returns in javascript
function double(arr) {
return arr.forEach(num => num*2);
}
console.log(double([1,2,3,4])) //undefined
function double(arr) {
return arr.forEach(num => num*2);
}
console.log(double([1,2,3,4])) //undefined