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
**
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)))