DEV Community


Discussion on: 5 ways to refactor if/else statements in JS functions

sylwiavargas profile image
Sylwia Vargas Author

Yeah it's one way to do it but that still keeps the same if-else (or just no-return-statement) logic that we want to ideally get rid of. Here I'd also worry about the performance as if-else is costly and so is looping and here we'd have looping inside if-else. But I like this example — thank you!