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

163
Views
JavaScript every() on array of object doesn't loop through all the array

This is my code, I'm using this method to validate https request parameters. Logging the entries I see that just the first element of 2 is passed and therefore not all the values are checked. What am I missing?

    static validateParameters(req) {
        let params = Object.entries(req.query);

        return params.every(([key, value]) => {
          console.log(key, value);
          return value != undefined || value != ''
        });

    }

Edit The input to the function is a https request, the parameters would be in a 2d array

[
  [ 'ids', '' ],
  [ 'currencies', 'eur' ]
]

I believed the return value was undefined, but was actually an empty string. In any case changing || to && solved it.

about 4 years ago · Santiago Gelvez
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!