Jump to content

boolean being bizare, saying 12349414.9041 < 15000


MadnessRed

Recommended Posts

If a problem that a script is not colouring a number as expected.

I have this

 

if(a >= b){ colour = 1 }else{ alert(a + '<' + b); }

 

however, it returns an alert saying

12349414.9041 < 15000

 

Any idea as to why this might be happening?

 

 

actually i think I have worked it out,

it is reading teh vaues as string and < refers to its alphabetic position,

 

eg

 

'aa' < 'z'

'11' < '9'

 

I have done a parseFloat and that sorted it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.