count for number js 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