That is a valid option. I would say it is preference. I tend to always favor
forEach, but that is my preference.
In this example because we are using
console.log which returns
undefined. So forEach could make sense. But, we could swap the
output with a different logging function that returns a value, maybe an index…
I didn’t see this at first, But I totally agree with you.
The reason I was saying that was because I had essentially eliminated the IF statement in my codebase as I had many other alternatives. Though starting with that, I set the expectation that functional alternatives would have come.