Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Round to 2 decimal places

function roundToTwo(num) {
    return +(Math.round(num + "e+2")  + "e-2");
}
console.log(roundToTwo(2.005));
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #Round #decimal #places
ADD COMMENT
Topic
Name
5+7 =