Program to count digits in an integer ( 4 Different Methods ) | Recursive Javascript program to count number of digits in a number ; Driver code
function countDigit ( n ) { if ( n / 10 == 0 ) return 1 ; return 1 + countDigit ( parseInt ( n / 10 ) ) ; } var n = 345289467 ; document . write ( " " + countDigit ( n ) ) ;