Using an object doesn't mean that you're doing OOP.
else if and Map both work for your case, but they're not interchangeable in general - one is a control structure and the other one is a data structure.
else if is not inherently bad, it can be the most precise solution for some specific problems.
The only thing you should actually stop is posting articles talking about "absolute" truths.
it's not just using an object, it's the context in which you use it, so there's no need to say this isn't OOP, yes I gave a small example but you can see there are examples in the comments supporting the idea.
of course they're not fully interchangeable but in certain cases they are.
No one said it's bad, it's just better to use other alternatives where everything is being repeated.
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
else if
andMap
both work for your case, but they're not interchangeable in general - one is a control structure and the other one is a data structure.else if
is not inherently bad, it can be the most precise solution for some specific problems.