Is there any way to shorthand a block like this?
if (popupIsvisible === false) {
this.show();
} else {
this.hide();
}
I've tried:
popupIsvisible === false? this.show() : this.hide();
but I get the error below:
Expected an assignment or function call and instead saw an expression
I don't want to assign to something just execute the hide/show depending on popupIsvisible.
The answer to your question is no! there is no way to do that as you want
but you you can just do this however I see no point doing that
if (popupIsvisible) this.show();
else this.hide();