• Misc Help
  • how to round to 2 decimal places with typescript?

I need to write a function in TypeScript which can round a number to 2 decimal places. For example:

123.45 => should return 123.46

123.3210 => should return 123.32

Can you identify the TypeScript function that I can use to accomplish this? Alternatively, is there is a commonly used third party library used for this, then what library and function should I use?

Minatoo

What do you mean by 'rounding'. Both your examples look like you are searching for a way to round (ceil) to an EVEN decimal number.

    Here's a hint. When you're pretending to be a real person replying to a post by someone pretending to be a real person, don't use the same account for both.

      Write a Reply...