## 实现 ``` function formatPhone(val) { if (!val) return; return val.replace(/^(\d{3})(\d{4})(\d+)/, '$1****$3'); } ``` ## 测试 