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

212
Views
boolean function: check whether first expression is executed or the second

I have a boolean return from a function which suggests 2 checks and according to the result a message is displayed

example:

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

displayed text

{{ greater (if first expression is executed) || {{ equal (if second expression is executed) }}

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

0

These conditions can be expressed in the markup...

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

Or, the way I prefer, in a method that's understood to produce a string for the markup...

<!-- 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!