JS 每日常用代码总结 _前端码农 2020-10-09 194 阅读1分钟 1. 关于手机号加密 const phone = '13595968984'; phone.substr(-4).padStart(phone.length, '*'); 保留手机尾号四位 2. 数组扁平化 const arr1 = [1, ['a', 3, ['c', 5]], 'b']; arr1.flat(Infinity)