I am trying to compare a value coming from a HTML text field with integers. And it works as expected. Condition is -
x >= 1 && x <= 999;
You should use parseInt if the var is a string. Add = to compare datatype value:
parseInt
datatype
parseInt(x) >== 1 && parseInt(x) <== 999;