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):
 var num = Number(v);

if ( isNaN(num)) console.debug("v is not a number");
Such a strange thing that num isn't null or that it doesn't throw an exception. The crazy typing stuff inside of languages :)


Popular posts from this blog

2 ways to get SQLite to put dates into columns

BootstrapX clickover

Bootstrap (by Twitter) loading in page content for Popovers