I store some parameters client-side in HTML and then need to compare them as integers. Unfortunately I have come across a serious bug that I cannot explain. The bug seems to
The alert() wants to display a string, so it will interpret "2">"10" as a string.
Use the following:
var greater = parseInt("2") > parseInt("10"); alert("Is greater than? " + greater); var less = parseInt("2") < parseInt("10"); alert("Is less than? " + less);