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

168
Views
Use la declaración de cambio con múltiples variables

Quiero usar la declaración de cambio con 2 variables, por ejemplo, a y b , algo como esto:

 switch(a,b){ case(1,1): // a = 1 and b = 1 doSomething() break case(1,2): // a = 1 and b = 2 doSomethingElse() break case(0,2): // a = 0 and b = 2 doOtherthings() break default doNothing() }

Sé que este código no funciona, ¿hay alguna forma alternativa de hacerlo?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Podría usar sentencias if en su lugar.

 if (a === 1 && b === 1) doSomething(); else if (a === 1 && b === 2) doSomethingElse(); else if (a === 0 && b === 2) doOtherthings(); else doNothing();
over 4 years ago · Santiago Trujillo 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!