NaN and 0

But also NaN != NaN.


function meNaN(optionalParameter:Number = NaN):Boolean
{
    return isNaN(optionalParameter);
}

trace(meNaN());
trace(meNaN(1));
trace(meNaN(null));

This is an exmaple of what I’m getting at. The function has an optional parameter, and the functionality will depend on whether a number is passed or not.
If this function is being called from somewhere else in the program, and passed a variable that has been retrieved from somewhere else. As long as something is passed (whether an actual number or null) it will never be NaN.

So this means the parameter will have to be cast with a wildcard? Feels a bit hacky to me, but I get like this sometimes!

Anyway, I do understand the situation, just wondering how other people might have dealt with it before.