Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript number length

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

export default numberLength;
 
PREVIOUS NEXT
Tagged: #javascript #number #length
ADD COMMENT
Topic
Name
2+8 =