if(isNaN(num1)) OR: if(typeof num1 == 'number'){ document.write(num1 + " is a number <br/>"); }else{ document.write(num1 + " is not a number <br/>"); }