Pergunta

So I am writing a javascript application, and basically if one number is greater than another I want to swap their values:

if(price1 > price2)
{
  var temp = price1;
  price1 = price2;
  price2 = temp;
}

This works fine up until a certain point, but once the numbers starting getting larger, i.e.:

price1: 12345678
price2: 234556

Then the expression will evaluate to false and will do nothing. Does anyone know what the issue is? Thanks!

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top