手机号码中间四位加星号

时间:2020-06-11 16:37:38   收藏:0   阅读:68
function tel(tel) {
    const telNum = tel.toString();  
    const reg = /^(\d{3})\d{4}(\d{4})$/;
    return telNum.replace(reg, ‘$1****$2‘)
}
tel(13212341234)

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!