DEV Community

Discussion on: It's working, why change it? - Code Review Chronicles

Collapse
 
dvddpl profile image
Davide de Paolis

agree.
switches are not bad. and are better then ifs
but it's better to have maps/objects than switches because they can grow more organically without much changes in the code, avoid issues like fallthrough and missing returns/break, better performance (you access directly the value by name/prop not by comparing to all the cases) and overall readability.