Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript round down to 2 decimal places

function roundDown(amount, decimal){
    decimal = +decimal;
    const value = +( 1 + (new Array(decimal + 1).join('0')).slice(-decimal));
    return Math.floor(+amount * value) / value;
} 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #decimal #places
ADD COMMENT
Topic
Name
9+7 =