Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react native float upto 2 digits

Use Math.round(num * 100) / 100

Edit: to ensure things like 1.005 round correctly, we use

Math.round((num + Number.EPSILON) * 100) / 100
 
PREVIOUS NEXT
Tagged: #react #native #float #upto #digits
ADD COMMENT
Topic
Name
9+6 =