Posts by Thiago Santos • 1 point
2 posts
-
0
votes3
answers320
viewsA: convert value to 2 decimal places in JS
I managed to do it with the following code: let x = '3710000000'; function format(num){ if(num < 1000) return num.toString(); if(num < Math.pow(10,6)) return (num / 1000).toFixed(2) + " k";…
javascriptanswered Thiago Santos 1 -
0
votes3
answers320
viewsQ: convert value to 2 decimal places in JS
I have the following script: var x = "202101000000"; var y = 0; //bilhao if(x.length >= 10 && x.length <= 12){ if (x.length == 10){ y = x.substr(0,1); }else if(x.length == 11){ y =…
javascriptasked Thiago Santos 1