check how many digits javascript code example
Example: javascript count digits
var length = (number + '').replace('.', '').replace('-', '').length; // for numbers that can be floats or negatives
var length = (number + '').replace('.', '').replace('-', '').length; // for numbers that can be floats or negatives