Question

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!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top