Page 1 of 1

[SOLVED] Pulling out my hair! IT IS A NUMBER!

Posted: Mon Jan 31, 2005 10:56 am
by patch2112
Hello all (stressed and non-stressed alike)

Here is code...

Code: Select all

function get_code_value()
{
var ei=1+1;

if (!isNaN(ei))
{ alert ("ei IS NOT a number"); }

if (isNaN(ei))
{ alert ("ei IS a number"); }

alert (ei);
}
The first alert I get says "ei IS NOT a number"
The second alert says "2".

How can I be getting "IS NOT a number" and yet get the 2 instead of 11?

Thanks,
Philip

Posted: Mon Jan 31, 2005 11:26 am
by wwwapu
isNaN tests if value is NaN (Not a Number) you are testing if the value is Not Not A Number

The first google on isNaN was: http://msdn.microsoft.com/library/en-us ... hisnan.asp

Sry

Posted: Mon Jan 31, 2005 12:16 pm
by patch2112
I'd like to formally apologize for being an idiot. Long Weekend.

Thanks,
Philip