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

277
Views
Is there any way to math min arrays inside array and return a array with the lowest numbers in each array? Javascript

Can't seem to wrap my head around this. Tried several solutions with for loops and math.min.

I have an array with arrays with numbers. I need to get the lowest number in each array.

Should look something like this.

let array = [[1, 2, 3],[85, 86, 87],[12, 13, 14],[8, 9, 10]]
let output = [[1],[85],[12],[8]]
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to perform this operation on each value of the array => .map

let array = [[1, 2, 3],[85, 86, 87],[12, 13, 14],[8, 9, 10]]


const min = array.map( arr => Math.min(...arr))

// with the desired format: let output = [[1],[85],[12],[8]]
const output = array.map( arr => [Math.min(...arr)])

console.log(min)
console.log(output)

about 4 years ago · Juan Pablo Isaza Report
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!