function chk_val(i) { var chk= parseInt(i); if(chk==NaN) { return false; } else { return true; } }; var n= chk_val(userInput); if(n) { // allow user to do xyz } else { // not a number! do something else. }
Leave a comment: