I need to represent a number with fixed amount of digits in total in Javascript (using NodeJs). In other words, fractional part is different depending on the overall value.
So 4.22525252525 becomes 4.22525, but 1242.122412512 becomes 1242.12, 124.2352352 becomes 124.235.
How can I achieve this?