js 满1000 进位


/**
* 10000 => "10,000"
* @param {number} num
*/
export function toThousandFilter(num) {
return (+num || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
}
posted @ 2022-09-22 09:08  闰土的土  阅读(9)  评论(0编辑  收藏  举报