html - Javascript string/integer comparisons -


i store parameters client-side in html , need compare them integers. unfortunately have come across serious bug cannot explain. bug seems js reads parameters strings rather integers, causing integer comparisons fail.

i have generated small example of error, can't explain. following returns 'true' when run:

javascript:alert("2">"10") 

parse string integer using parseint:

javascript:alert(parseint("2", 10)>parseint("10", 10)) 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -