Conditional if then statements issues

Hi,
I was wondering if there was a good website for really diving into conditional if/then statements. I know basically how they work

togglePrice() {
                return this.showPrice ? this.showPrice = false : this.showPrice = true;
            },

However what if I want to run a method and make it equal false like so

togglePrice() {
                return this.showPrice ? this.clearAllData(); this.showPrice = false : this.showPrice = true;
            },

How would I do that?

Hi. Can’t you use if statement?

togglePrice() {
  if (this.showPrice) {
    this.clearAllData();
    this.showPrice = false;
  } else {
     this.showPrice = true;
  }
},

I can, I was just hoping to learn more about conditional if statements.

This is my opinion but they should only be used in simple statements and they can only have condition ? expression-true : expression-false

If you can’t write it on a short line. Don’t use it. If you feel a need to nest it. Don’t use it :grinning: I have read to much cryptic and over cleaver code using this construction.