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

288
Vistas
how to return the lowest number using filter JavaScript? Is there another solution?
let string = '10 200 100 1000 5000';

let arr = string.split(' ').filter(function (a) {

    return a.startsWith(1) && a.length === 2

})

document.write(arr)
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

We first split string to each individual piece with (' ') seperator and using map we go over each piece and convert each piece of string to a number with parseFloat(). Let's use parseFloat just in case there might be decimal values. Last step is to spread the array with ... and to return the minimum value from array of numbers using Math.min().

    const string = '200 100 10 1000 567 5000 2314235423532';

    const lowest = Math.min(
      ...string.split(' ').map((piece) => {
        return parseFloat(piece);
      })
    );

    console.log(lowest);

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