I'm currently trying to squeeze every last millisecond from a JavaScript program that is fired on an event listener at a rate of 10x per second. I'm trying to remove all cruft. When an if block's sole purpose is to return something if true, is there any advantage to following with else if or else, or am I right in thinking that I forgo else.
eg.
// with else
function withElse () {
if (foo) {
return foo;
} else if (bar) {
return bar;
} else {
return baz;
}
}
// without else
function withoutElse () {
if (foo) return foo;
if (bar) return bar;
return baz;
}