Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda