手机号中间四位变成*
结果:
/**
*
* @param {*} tel 电话号码
* @returns
*/
const telFormat = (tel) => {
tel = String(tel);
return tel.substr(0,3) + "****" + tel.substr(7);
};
console.log(telFormat("123456789011"))
结果:
/**
*
* @param {*} tel 电话号码
* @returns
*/
const telFormat = (tel) => {
tel = String(tel);
return tel.substr(0,3) + "****" + tel.substr(7);
};
console.log(telFormat("123456789011"))