Formatting Values With Units For Display
There are all kinds of values and units your app may need to display. The Intl.NumberFormat
API that is available in modern browsers can help with standardizing that display.
How about formatting distances for display?
Here is a compact formatting of miles:
Here is two different formats for kilometers:
Give it a try with something else like miles-per-hour
, liter
, or gallon
.
Last updated