npm install yup; best javascript package for input validation or you can write your own code for example - to validate number var a = 12 if(isNumber(a) && someOtherCondition){ // do something }else{ alert("invalid input") }