NaN : Not A Number

NaN is known as Not A Number

It is a returned value
It is not configurable and not writable.

Example of NaN

When we will get output as NaN ?
<script>
var a = 'xyz';
document.write(a*2); // Output NaN
</script>

Not equal to itself

NaN is the only JavaScript value which is not equal to itself.
<script>
var a = NaN;
if(a === a){
document.write('Equal')	
}else{
document.write('Not Equal')		
}
</script>
The output will be Not Equal User entered data from an input text box is always a string, so for any mathematical calculation we need to convert them to number by using parseFlot or parseInt. Otherwise we will get NaN as output of any mathematical calculation if we use directly these inputs.
Your Rating





Post your comments , suggestion , error , requirements etc here .




HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer