use casting in javascript to count the number of digits in an integer code example Example: javascript length of number x.toString().length // x is a number