Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!