Logarithm tricks for Competitive Programming | Function to count the number of digits in a number ; Driver program to test above
function countDigit ( n ) { return Math . floor ( Math . log10 ( n ) + 1 ) ; } var n = 80 ; document . write ( countDigit ( n ) ) ;