function roundDown(amount, decimal){ decimal = +decimal; const value = +( 1 + (new Array(decimal + 1).join('0')).slice(-decimal)); return Math.floor(+amount * value) / value; }