3 ms·
I really like early returns for this reason. if (someEdgeCase) { return SpecialValue; } const normalCase = a + b ... It allows you to drop a case from wo
by feoren 3y ago
I really like early returns for this reason.
if (someEdgeCase) {
return SpecialValue;
}
const normalCase = a + b ...
It allows you to drop a case from working memory as early as possible. I believe this would be a +1 in cyclomatic complexity, but it shouldn't be. Cyclomatic complexity is not the whole story (nor do I think it tries to be).