Replacing switch statement with Object literal with booleans

Viewed 42

I have this switch statement where a, b, c and d can be true or false, but only one of them is going to be true, and when one of them is true it returns X which is a variable. How can I replace this switch statement with an object literal?

switch (true) {
        a: return x
        b: return x
        c: return x
        d: return x
      }
0 Answers
Related