JavaScript Count Digits
var length = (number + '').replace('.', '').replace('-', '').length; // for numbers that can be floats or negatives
Narshe
var length = (number + '').replace('.', '').replace('-', '').length; // for numbers that can be floats or negatives
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;
}