JavaScript Number.toLocaleString() with 4 digits after separator
format, javascript, numbers
Solution
You may use second argument to provide some options. In your case, with default locale:
number.toLocaleString(undefined, { minimumFractionDigits: 4 })
Problem
Is there a way to get `number.toLocaleString()` with 4 digits after the comma? Example: ``` var number = 49.9712; document.getElementById('id').innerText = number.toLocaleString(); ``` Result: 49,9712 But now it always returns number with 2 digits after comma: 49,97