Is it ok to have NaN while comparing fields in JavaScript?
A blank string is not equal to null, therefore it can get through. 
parseInt('') returns a NaN.
Always use parseInt() with the radix (the second parameter). In some implementations, it doesn't default to base 10 (decimal).
As much as possible, use string comparison (===, !==, etc). It's best practice.




Instead, check for a blank string. Then instead of parseInt, you can do a +.

var text = *get value*
if(text !== ''){
  var number = +text;
}