Possible Duplicate:
Comparing NaN values for equality in Javascript
Can anyone tell me why this is not working?
if(inbperr == NaN) {
document.getElementById('inbclo').value = "N/A";
}
else {
document.getElementById('inbclo').value = "%" + inbperr;
}
Instead of returning a percentage value, or "N/A", I want it to return "%NaN".
NaN
's are unusual: they are not equal to anything, even themselves. You need to use isNaN(inbperr)
to tell whether a value is a NaN or not.