从千分位格式化谈JS性能优化
http://heeroluo.net/article/detail/115
方法六
// 方法六 function toThousands(num) { return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, ‘$1,‘); }
时间: 2024-11-05 13:03:54
http://heeroluo.net/article/detail/115
方法六
// 方法六 function toThousands(num) { return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, ‘$1,‘); }