x.toString().length // x is a number
var number = 773;
number.toString().length;
var num = 1234
number.toString().length; // 4
export function numberLength(number) {
let length = 0;
let n = Math.abs(number);
do {
n /= 10;
length++;
} while (n >= 1);
return length;
}
export default numberLength;
//This is correct but...
a = 123456
a.toString().length // x is a number
console.log(a.toString().length) //6
//Remeber that if the number begins with a Zero, that will not be counted.
// So 0123456073 will give you 9 instead of 10.
// I felt this is nice to know as I struggled with it a little