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

177
Visualizações
How can I get the number of items in a filtered array in JavaScript

I was trying to divide the number of items in a filtered array but it kept showing me undefined, NAN, or the number of letters in that particular filter when I send it to the console. But what I want to get is the number of items in the filter.

Here is the code I wrote: for (let i = 0; i < categories.length; i++) {

categories[i].addEventListener('click', (e) => {

    const filterF = e.target.dataset.category;

    dogProducts.forEach((product) => {
        if (product.classList.contains(filterF)) {
            product.style.display = 'block';
            ulTag.style.display = 'none';

            console.log(products);

        } else {
            product.style.display = 'none';
            ulTag.style.display = 'none';
        }

    })
})

}

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