Nov 4, 2013

what is isNAN function in javascript ?

isNAN function checks the argument and returns true if the argument is not a number else return false


Example of isNAN()

var val='04cs'; 

if(isNAN(val))
{
alert('this is not a number') ;
}else{
alert('this is a number')  

}


ANS : this is not a number


var value='0411'; 

if(isNAN(value))
{
alert('this is not a number') ;
}else{
alert('this is a number')  

}


ANS : this is a number

No comments:

Post a Comment