Categories
Formats a number as a percentage.
Contributed by @itsbrunodev
function formatPercentage(value, decimalPlaces = 2) { return `${(value * 100).toFixed(decimalPlaces)}%`; }
formatPercentage(0.1234); // "12.34%"