Javascript and NaN
I always seem to forget but you have to use the function isNaN to test javascript variable. I always want to write it wrong with value == NaN...
Here is an example of it (not a great one but a general idea of what's going on):
Here is an example of it (not a great one but a general idea of what's going on):
var num = Number(v);Such a strange thing that num isn't null or that it doesn't throw an exception. The crazy typing stuff inside of languages :)
if ( isNaN(num)) console.debug("v is not a number");
Comments
Post a Comment