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

221
Views
Verifique dos variables en el caso del interruptor js

Tengo 2 variables que devuelven verdadero y falso. Y quiero que cada uno que fue falso devuelva el texto correspondiente. ¿Cómo manejar este ValidChecked y repeatChecked en el interruptor?

 export const checked = (e, options) => { const nameCheked = new RegExp("^[a-zA-Z0-9]{1,50}$"); const repeatChecked = options.every( (pool) => pool.text.toLowerCase() !== e.target.value.toLowerCase() ); const validCheked = nameCheked.test(e.target.value); switch (repeatChecked) { case true: return { type: true, text: "looks good" }; case false: return { type: false, text: "repeatName" } case validCheked = true: return { type: true, text: "looks good" } case validCheked = false: return { type: true, text: "Invalid name (no special character)" } default: return { type: false, text: "looks good" } } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede usar una estructura de cambio como esta:

 switch (true) { case (repeatChecked== true && validCheked == true): //do something (if you return something here, don't need to break;) break; case (repeatChecked== false && validCheked == false): //do something (if you return something here, don't need to break;) break; ... }
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!