function formatPhone(phone) { return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2"); }姓名显示最后一个字,其余用星号代替
function
on
formatPhone
return
replace
/(\d{3})\d{4}(\d{4})/
"$1****$2
$
"
'实打实的'.replace(/.(?=.)/g, '*');
'实打实的
'.replace
'*
'
return new Array(str.length).join('*') + str.substr(-1);
new
length
join
+
substr
1