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

215
Views
función booleana: comprueba si se ejecuta la primera expresión o la segunda

Tengo un retorno booleano de una función que sugiere 2 comprobaciones y, según el resultado, se muestra un mensaje.

ejemplo:

 <script> function guessTheNumber(p1) { const test = 5; return p1 > 6 || p1 === test ; } </script>

texto mostrado

{{ mayor (si se ejecuta la primera expresión) || {{ igual (si se ejecuta la segunda expresión) }}

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

0

Estas condiciones se pueden expresar en el marcado...

 {{ p1 > 6 ? 'greater than 6' : (p1 === 5 ? 'equal to 5' : 'neither' ) }}

O, como prefiero, en un método que se entienda que produce una cadena para el marcado...

 <!-- in the markup --> {{ theThingAboutP(p1) }} // in methods: {} theThingAboutP(p1) { if (p1>6) return 'greater than 6'; if (p1===5) return 'equal to 5'; return 'neither'; }
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!