A
B
Seen a lot of the former practice at my workplace lately and tbh it's totally bothering me, I'd put human readability above most things. Are you all about saving characters? Is the former actually somehow "safer" in your opinion?
(Edit: I should've made the example more dirty to make using a ternary not the easy answer, but yeah, just assume that's not plausible here)
Code:
function doThing() {
if (condition) {
return 1;
}
return 2;
}
B
Code:
function doThing() {
if (condition) {
return 1;
} else {
return 2;
}
}
Seen a lot of the former practice at my workplace lately and tbh it's totally bothering me, I'd put human readability above most things. Are you all about saving characters? Is the former actually somehow "safer" in your opinion?
(Edit: I should've made the example more dirty to make using a ternary not the easy answer, but yeah, just assume that's not plausible here)
Last edited: