Function isValidPhoneNumber

  • Check if the given string is a mobile phone number.

    Usage:

    const ret1 = isMobile('13800138000');
    const ret2 = isMobile('1380013800');
    const ret3 = isMobile('138001380000');
    const ret4 = isMobile('1380013800a');
    console.log(ret1, ret2, ret3, ret4);

    Output:

    true false false false
    

    Parameters

    • mobile: string

    Returns boolean

    Return true if the given string is a mobile phone number.