Nombre de chiffres en javascript
function digitCount(num) {
if(num === 0 ) return 1
return Math.floor(Math.log10(Math.abs(num))) + 1
}
Courageous Cardinal
function digitCount(num) {
if(num === 0 ) return 1
return Math.floor(Math.log10(Math.abs(num))) + 1
}
var length = (number + '').replace('.', '').replace('-', '').length; // for numbers that can be floats or negatives