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

111
Vistas
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 Respuestas
Responde la pregunta

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