手机号中间四位变成*

结果:

/**
 * 
 * @param {*} tel 电话号码 
 * @returns 
 */
const telFormat = (tel) => {
    tel = String(tel); 
        return tel.substr(0,3) + "****" + tel.substr(7);
    };
console.log(telFormat("123456789011"))

 

posted @ 2022-05-26 22:28  前端搬运工bug  阅读(38)  评论(0编辑  收藏  举报