Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

159
Views
Shorthand if/else statement without assign

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.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!