So, i have amount, for example 180000.20 and i need to make from it a string like that "180,000.20". After every three integers need to add "," starting from the end.
let amount = 180000.20
amount.toString().split("").reverse().reduce((a, e, i) => a + e + (i % 3 === 2 ? "," : ""), "").split("").reverse().join("").replace(???, "")
What to write in replace()? And may be there is a way how to write this shorter?