DEV Community

Discussion on: Escape If-else hell in Javascript

Collapse
essanousy profile image
mohamed es-sanousy

Why do you need elseif when return breaks the scope :
If condition1
Return value1;
If condition2
Return value2;
...

Return null;

Collapse
melvnl profile image
Melvin Liu Author

it's more about readability, and clean code, just imagine when you have more than 20 different conditions.