js中手机号脱敏

//通过字符串截取中间四位数字,转化为****
function sencePhone(val) { let returnVal
= val if (val) { returnVal = val.substr(0, 3) + "****" + val.substr(7) } return returnVal }
sencePhone("15666666666");//156****6666
 
原文地址:https://www.cnblogs.com/yixiancheng/p/13818876.html