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

172
Vistas
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 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