DEV Community

Discussion on: Stop using if else

Collapse
 
dominikbraun profile image
DB • Edited
  • 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.
Collapse
 
rjitsu profile image
Rishav Jadon
  • 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