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

138
Views
Can i see big number with Array.prototype.reduce
const squareList = arr => {

    return arr
        .filter(number => number > 0 && number % parseInt(number) === 0)
        .map(number => Math.pow(number, 2)) // [25,9]
        .reduce((bigN, number) => bigN > number)
};
const squaredIntegers = squareList([-3, 4.8, 5, 3, -3.2]);
console.log(squaredIntegers); // true

My purpose is to print the big number in the array to the console after reduce, but I couldn't find how to see the numbers in the string and how to compare them.

Can I do this with reduce?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

most likely you want your reduce function to look like this:

 reduce((bigN, number) => bigN > number ? bigN : number)

but you can also use Math.max function:

const squareList = arr => {
    return Math.max(...arr
        .filter(number => number > 0 && number % parseInt(number) === 0)
        .map(number => Math.pow(number, 2)))
};
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!