javascript - JS - Format number with 2 decimal not rounded -
i format number 2 decimal places without rounding. excluded tofixed() function.
i have tried way
a = 1,809999 b = 27,94989 = math.floor(a * 100) / 100; --> 1,8 b = math.floor(b * 100) / 100; --> 27,94 or = number(a.tostring().match(/^\d+(?:\.\d{0,2})?/)); --> 1,8 b = number(b.tostring().match(/^\d+(?:\.\d{0,2})?/)); --> 27,94
unfortunately, second decimal of zero, , deleted, how keep , have = 1.80? thank you
Comments
Post a Comment