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

179
Views
Using OR for two possible errors inside try catch in JS

I have to possible error inside a try catch block like below:

try {
  let result = A || B;
  // use result
} catch(e) {
  console.log("ERROR")
}

Each of A or B can throw error. Waht I need is I want to refer to catch only in situation both A and B throw error. is it possible?

**Note: I know that I can use separate try-catch for each of them. I was wondering if I can write it inside just single try-catch block

about 4 years ago · Juan Pablo Isaza
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!