Dimensionless: unit: null
let formatter =
new Intl.NumberFormat(locale, {
style: "unit",
});
formatter.format({
value: 333,
unit: null,
});
null is used for a number with explicitly no unit.
Fallback: unit: undefined
formatter.format({
value: 333,
unit: undefined,
[Symbol.toPrimitive](hint) {
return hint === "number"
? 111 : 222;
},
});
No difference between explicit undefined and a missing field.