手机号码中间四位加星号

function tel(tel) {
    const telNum = tel.toString();  
    const reg = /^(\d{3})\d{4}(\d{4})$/;
    return telNum.replace(reg, '$1****$2')
}
tel(13212341234)

 

posted @ 2020-06-11 15:42  莫欺少年穷呐  阅读(357)  评论(0编辑  收藏  举报