6 lines
132 B
JavaScript
6 lines
132 B
JavaScript
function formatPercent(n, fixed = 1) {
|
|
return String((n.toPrecision(2) * 100).toFixed(fixed));
|
|
}
|
|
|
|
module.exports = formatPercent;
|