
Gabriel F. answered 10/31/19
Full stack Javascript Engineer
Hi there. The return statement should always break out of the function scope execution.
According to the MOZ docs:
The return
statement ends function execution and specifies a value to be returned to the function caller.
I don't know what your use case is but I imagine (speculate) you may have a function returning inside another function or a forEach loop, in which case your inner function is returning but the forEach method would still be executing (maybe it is something else but you should document it in the question so the scenario is clear).
I hope this helps.