Answers for "get number right of the dot length javascript"

0

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; 
}
Posted by: Guest on June-16-2020

Code answers related to "get number right of the dot length javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language