javascript length of number
snippet in javascript

javascript length of number

user3301

x.toString().length // x is a number

javascript number length

user6110

export function numberLength(number) {
	let length = 0;
	let n = Math.abs(number);
	do {
		n /= 10;
		length++;
	} while (n >= 1);
	return length;
}

export default numberLength;