[Solved] return statement inside foreach always return undefined [closed]


so basically when you use forEach you say that you want to a particular thing for every element, note that to accomplish that task you dont need to return anything and even if you do, just think what use will it be ?

but when you map you want every element to be converted to something, now this something has to be the return value of the function inside map

1

solved return statement inside foreach always return undefined [closed]