Does the map method always use a return statement?
Because in this example, there is a return statement showing in the myFunction function:
const numbers1 = [45, 4, 9, 16, 25];
const numbers2 = numbers1.map(myFunction);
function myFunction(value, index, array) {
return value * 2;
}
if you use arrow functions you don't have to add return but you use regular functions like above your instaces you have to add return you don't return you will get undefined or null.