I am looking for the most efficient way to write this ternary.
id === this.mygroup ? this.mygroup = '' : this.mygroup = id;
This is in a vuejs method but I suppose it does not matter.
Should I copy to a local var so it does not read it multiple times?
let activeGroup = this.mygroup id === activeGroup ? activeGroup = '' : activeGroup = id;
this.mygroup = id === this.mygroup ? '' : id;
this.mygroup to either
id, which is what you want