Trying to assign two constants based on a single condition has led me to the following options:
const success = thing ? valueS1 : valueS2;
const failure = thing ? valueF1 : valueF2;
Alternatively, I considered:
if (thing) {
const success = valueS1;
const failure = valueF1;
}
else {
const success = valueS2;
const failure = valueF2;
}
While both methods are valid, I'm not entirely fond of the readability. Is there a trick to make this more concise?