DEV Community

Lakshya Tyagi
Lakshya Tyagi

Posted on • Edited on

Validate Phone Number

validatePhoneNo(num) {
    var phonenum = /^\d{10}$/;
    var str = num;
    if((str.match(phonenum))) {
        return true;
    } else {
        return false;
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)