Javascript is really bugging my head. At first I was using this code :
var val = document.getElementById("inputField").value; // User entered "2"
while (val < 5)
{
val += 1
alert(val);
}
But it would do 5+1 = 51 unless I use parseInt before entering the while loop. So that means that val is Not a Number. But however it has no problem considering val as a number upon entering the while loop, in the expression(val < 5). Why is it so ? It looks illogical to me, unless you tell me that "that's the way it is". Ty