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

217
Views
Nested conditional ternary operator in javascript

I have the below code, where idName is selected based on id1 or id2.

const getValues = async ({ id1, id2, ...request}) => {
   const id = id1 || id2;
   const idName = id1? 'uid' : 'sid';
 };

Now, I add another parameter "id3" and which needs to get selected when id1 is not passed in as input. But the below code throws an error. Any leads would be appreciated.

const getValues = async ({ id1, id2, id3, ...request}) => {
   const id = id1 || id2 || id3;
   const idName = id1 ? id3 ? ('uid' : 'sid') ? (id3);
 };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

const getValues = async ({ id1, id2, id3, ...request}) => {
   const id = id1 || id2 || id3;
   const idName = id1? 'uid': id3? 'something-for-id3': 'sid'
};
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!