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

191
Visualizações
Counting the number of values that are true in a list of objects

I have a percentage component im working on and I need a way to go through a set of data and figure out how many items have the value audited set to true. My data looks like this

{[{id: 1, audited: true},{id:2, audited: false}...]}

this is what Ive tried so far

 const a = [];
 let list = Object.values(items || {}).map((item) => {
        console.log("ITEM", item);
        if (item.audited === true) {
          a.push(item);
        }
        return a;
      });

My plan was to check the length of a and use that as my value. But what Ive done here is way overkill if I console out list its an array of all the items that pass the if test and the length of the array is the number of passes. All I need is the number of items in the object that have been audited. Any advice on how to clean this up would be very helpful I am new to coding so pls be kind.

about 4 years ago · Juan Pablo Isaza
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