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

278
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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