Intl.NumberFormat
Input
Alternativ use
Intl.NumberFormat can also be used from Number.prototype.toLocaleString()
const number = 123456.789
number.toLocaleString(undefined)
123,456.789
Output
unitDisplay
{
unitDisplay: "long"
}
123,456.789
{
unitDisplay: "short"
}
123,456.789
{
unitDisplay: "narrow"
}
123,456.789
compactDisplay
{
compactDisplay: "short"
}
123,456.789
{
compactDisplay: "long"
}
123,456.789
notation
{
notation: "standard"
}
123,456.789
{
notation: "scientific"
}
1.235E5
{
notation: "engineering"
}
123.457E3
{
notation: "compact"
}
123K
signDisplay
{
signDisplay: "auto"
}
123,456.789
{
signDisplay: "never"
}
123,456.789
{
signDisplay: "always"
}
+123,456.789
{
signDisplay: "exceptZero"
}
+123,456.789
useGrouping
{
useGrouping: true
}
123,456.789
{
useGrouping: false
}
123456.789
minimumIntegerDigits
{
minimumIntegerDigits: 1
}
123,456.789
{
minimumIntegerDigits: 2
}
123,456.789
{
minimumIntegerDigits: 3
}
123,456.789
{
minimumIntegerDigits: 4
}
123,456.789
{
minimumIntegerDigits: 5
}
123,456.789
minimumFractionDigits
{
minimumFractionDigits: 1
}
123,456.789
{
minimumFractionDigits: 2
}
123,456.789
{
minimumFractionDigits: 3
}
123,456.789
{
minimumFractionDigits: 4
}
123,456.7890
{
minimumFractionDigits: 5
}
123,456.78900
maximumFractionDigits
{
maximumFractionDigits: 1
}
123,456.8
{
maximumFractionDigits: 2
}
123,456.79
{
maximumFractionDigits: 3
}
123,456.789
{
maximumFractionDigits: 4
}
123,456.789
{
maximumFractionDigits: 5
}
123,456.789
minimumSignificantDigits
{
minimumSignificantDigits: 1
}
123,456.789
{
minimumSignificantDigits: 2
}
123,456.789
{
minimumSignificantDigits: 3
}
123,456.789
{
minimumSignificantDigits: 4
}
123,456.789
{
minimumSignificantDigits: 5
}
123,456.789
maximumSignificantDigits
{
maximumSignificantDigits: 1
}
100,000
{
maximumSignificantDigits: 2
}
120,000
{
maximumSignificantDigits: 3
}
123,000
{
maximumSignificantDigits: 4
}
123,500
{
maximumSignificantDigits: 5
}
123,460
roundingIncrement
{
roundingIncrement: 1
}
123,456.789
{
roundingIncrement: 2
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 5
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 10
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 20
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 25
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 50
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 100
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 200
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 250
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 500
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 1000
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 2000
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 2500
}
maximumFractionDigits value is out of range.
{
roundingIncrement: 5000
}
maximumFractionDigits value is out of range.
roundingMode
{
roundingMode: "ceil"
}
123,456.789
{
roundingMode: "floor"
}
123,456.789
{
roundingMode: "expand"
}
123,456.789
{
roundingMode: "trunc"
}
123,456.789
{
roundingMode: "halfCeil"
}
123,456.789
{
roundingMode: "halfFloor"
}
123,456.789
{
roundingMode: "halfExpand"
}
123,456.789
{
roundingMode: "halfTrunc"
}
123,456.789
{
roundingMode: "halfEven"
}
123,456.789
roundingPriority
{
roundingPriority: "auto"
}
123,456.789
{
roundingPriority: "morePrecision"
}
123,456.789
{
roundingPriority: "lessPrecision"
}
123,456.789
trailingZeroDisplay
{
trailingZeroDisplay: "auto"
}
123,456.789
{
trailingZeroDisplay: "stripIfInteger"
}
123,456.789
localeMatcher
{
localeMatcher: "best fit"
}
123,456.789
{
localeMatcher: "lookup"
}
123,456.789