Validate User Input With this JavaScript try and catch Example