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

170
Visualizações
Javascript: count unique instances of an element in an array

I'm very new to Javascript and I'm encountering something I thought would be simple but I'm totally hitting a roadblock. I'm more familiar with PHP/MySQL, but I have to use Javascript for this because it will be running in Adobe InDesign.

I have a CSV file with limited data. I've created an array for it split by rows, and then created an array from that separating the "columns" of the CSV data.

What I want to do is count only the unique values contained among the first column.

I've tried a handful of different examples scattered across the web, but they all seem to generate an error. I'm not sure if this is because of some limitations of Adobe ExtendScript or if I'm thinking about Javascript all wrong...

I think the form I'm expecting part of this to take uses something along the lines of:

if (arrayWithColumns[0].includes(specificValue)) {
      // don't do anything
} else {
     allMyUniqueValues = allMyUniqueValues.push(arrayWithColumns[0]);
}

And then I'd use allMyUniqueValues.length to give me what I need...?

Am I even on the right track?

Thanks everyone/anyone!

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