将手机号码的中间四位数替换为*

将手机号码的中间四位数替换为*

let phone = 15012347052
function formatPhone(phone) {
if(typeof phone == 'number') phone = phone.toString()
return phone.substring(0, 3) + '****' + phone.substring(7, phone.length)