I could have used n.toLocaleString(undefined, {maximumFractionDigits: 1}), where the undefined is passed for the locales parameter (which we want to stay as the user locale). I felt the undefined was a little awkward, and the math is simple enough, but if you feel otherwise I can change it.
I could have used
n.toLocaleString(undefined, {maximumFractionDigits: 1})
, where theundefined
is passed for thelocales
parameter (which we want to stay as the user locale). I felt theundefined
was a little awkward, and the math is simple enough, but if you feel otherwise I can change it.Before:
After: