isNaN gotchya’s

Thursday 11th June, 2009

Ahh, the joy of web development! This link documents rather well the trick about a supposedly simple function, isNaN, ("is not a number"). After applying first-aid to my bleeding knuckles and reading this, you would think that isNaN should be renamed "isNotANumberOrBlankOrEmpty( )"... The solution is to run parseInt to get a true result for isNaN when you use the ol double quotes or empty values.

I had heard javascript was conceived over a weekend between geeks with too much pizza and coke. Probably not, but with functional behaviour like that demonstrated in isNaN, one would think otherwise....

Comments [0]


Previous Document    Next Document