I found this code in some website, and it works perfectly. It validates that the phone number is in one of these formats: (123) 456-7890 or 123-
realy simple
"9001234567".match(/^\d{10}$/g)