Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

118
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda