dario@win11 MINGW64 ~ $ node Welcome to Node.js v20.13.1. Type ".help" for more information. > function truncate(number,decimals_count){ number *= 10**decimals_count; number = Math.trunc( number ); number /= 10**decimals_count; return number; } undefined > Math.round(3.149) 3 > Math.trunc(3.149) 3 > (3.149).toFixed(2) '3.15' > truncate(3.149,2).toString() '3.14' > function round(number,decimals_count){ number *= 10**decimals_count; number = Math.round( number ); number /= 10**decimals_count; return number; } undefined > round(3.149,2).toString() '3.15' >