Skip to content

Latest commit

 

History

History
5 lines (4 loc) · 218 Bytes

File metadata and controls

5 lines (4 loc) · 218 Bytes
const addCommas = (num) => (!num) ? null : num.toString().split('.').map((n,i) => (i === 0) ? n.replace(/\B(?=(\d{3})+(?!\d))/g, ',') : n).join('.');

// addCommas(9999999.9999) === "9,999,999.9999"