Home > JavaScript > JavaScript Function isNaN

JavaScript Function isNaN

December 24th, 2007 Leave a comment Go to comments

Small JavaScript function to check if a variable is a number.

function checkValue(value){
  if(isNaN(value)){
    return false;
  }else{
    return true;
  }
}

Use this in your form validation if you are checking to see that a user has entered a number.

  1. No comments yet.
  1. No trackbacks yet.