function foo(a, b, c, d) { let x = {}; if (someVal) { x = {b}; } else { x = {c}; } return x; }