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

135
Views
How to change this js condition in a way that will ignore the 0 case in JS?

I have the following condition.

if (!product.tag_id) {
  return;
}

How can I change it in a way that for the tag_id which is equal to 0 it will not return wrong thing. Now it considers tag_id:0 as false value and returns nothing. How can be it fixed?

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

0

if (!product.tag_id && product.tag_id !== 0) return;
// Do something else

This checks for if the product tag id is not equal to zero before returning.

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!