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

279
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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