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

110
Views
switching the order of the methods changes the result

the following will be the code

let a = 100;

let b = 2_00.5;

let c = 1e2;

let d = 2.4;

console.log(Math.min(Math.round(a, b, c, d)));

console.log(Math.round(Math.min(a, b, c, d)));

**

the wanted answer is 2.

with the first one, I get 100. How am I getting 100?

with the second one, I get the desired answer.

can someone explain this to me?

thanks

**

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

0

Math.round() accepts just one argument, so arguments b,c,d are ignored in your first example; its the same as calling Math.round(a)

To change the order the functions are called:

Math.round(Math.min(a, b, c, d))

is equivalent to

Math.min(...[a,b,c,d].map(x => Math.round(x)))
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!