Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda