Always display at least two decimal places
How about using Intl :
Intl.NumberFormat(navigator.language, {
minimumFractionDigits: 2,
maximumFractionDigits: 10,
}).format(num)
You could fix to 2 or the count of current places;
var result = num.toFixed(Math.max(2, (num.toString().split('.')[1] || []).length));