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

286
Views
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 answers
Answer question

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