JavaScript format number with commas using toLocaleString()

JavaScript format number with commas using toLocaleString()

7 months ago
raja $aqm1-J6ZlN

const number = 1234567.89;

const formattedNumber = number.toLocaleString();

console.log(formattedNumber)

// Output: "1,234,567.89"

https://medium.com/@onlinemsr/big-numbers-no-worries-javascript-format-number-with-commas-17ec7f878834

JavaScript format number with commas using toLocaleString()

Sat Mar 23, 11:38am UTC
const number = 1234567.89; const formattedNumber = number.toLocaleString(); console.log(formattedNumber) // Output: "1,234,567.89" https://medium.com/@onlinemsr/big-numbers-no-worries-javascript-format-number-with-commas-17ec7f878834