JavaScript Defining static fields with conditions in a class

I want to create code(example) like this:

class foo {
    static [x % 2 == 0]() {
        return x / 2;
    }
    static [x % 2 == 1]() {
        return x * 3 + 1;
    }
}

I tried many ways but it didn’t work.

Is it possible to get the key value used to access a field in JavaScript?
Or is it possible to give default values ​​to undefined fields?