format zero number after dot js code example
Example 1: javascript show 2 decimal places
var myNumber=12.2345;
var myNumberWithTwoDecimalPlaces=parseFloat(myNumber).toFixed(2); //12.23
Example 2: get number right of the dot length javascript
var x = 23.453453453;
x.countDecimals(); // 9
var countDecimals = function (value) {
if(Math.floor(value) === value) return 0;
return value.toString().split(".")[1].length || 0;
}