Issue
For example, I have a number 123.429. How can I remove the trailing decimals without rounding up to two decimal place.
Hence, I need the number to be up to two d.p. i.e 123.42.
Definitely toFixed() method or Math.round(num * 100) / 100 cannot be used in this situation.
Solution
var number = parseInt('' + (num * 100)) / 100;
Answered By - awe
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.