I run into the issue when isNaN was returning false for empty string.
Turned out this is by design, because isNan is comparing coerced values - coercing empty string into 0, and of course, not having issue with 0 not being a number.
To make sure that user has to enter 0, I added this to the check:
isNan(parseInt(field))
Of course, this is not comprehensive solution, Douglas Crockford has more to say on this topic, especially on recognizing the numbers, but it worked for simple validation I was aiming for.
Turned out this is by design, because isNan is comparing coerced values - coercing empty string into 0, and of course, not having issue with 0 not being a number.
To make sure that user has to enter 0, I added this to the check:
isNan(parseInt(field))
Of course, this is not comprehensive solution, Douglas Crockford has more to say on this topic, especially on recognizing the numbers, but it worked for simple validation I was aiming for.