Hey !
I don't think you should use map like this. You use it like a forEach, and junior developer could think it's okay to use it like this while it's not :/
I am a Software Engineer and Developer Advocate who loves sharing knowledge via writing, videos, mentorship, and working out. Please Subscribe: https://www.youtube.com/channel/UCcz5Bvr4kGHPFAjvnRhIQ4g
Well, your "forEach" and "map" examples are the same, so we could think that both are good to use. But the map (and I'm sure you know it) is used to make a new array, not to find something, filter something or whatever.
It's not because you can do it with map that you should use it and promote it :)
I am a Software Engineer and Developer Advocate who loves sharing knowledge via writing, videos, mentorship, and working out. Please Subscribe: https://www.youtube.com/channel/UCcz5Bvr4kGHPFAjvnRhIQ4g
Hey !
I don't think you should use map like this. You use it like a forEach, and junior developer could think it's okay to use it like this while it's not :/
PamProg thank you for taking your time to read and comment. Can you explain further?
Well, your "forEach" and "map" examples are the same, so we could think that both are good to use. But the map (and I'm sure you know it) is used to make a new array, not to find something, filter something or whatever.
It's not because you can do it with map that you should use it and promote it :)
Thank you. You are awesome 😍