Preview:
function num_of_digits(num) {
	let cnt = 1;
	num = Math.abs(num);
	num = Math.floor(num/10);
	while(num != 0){
		cnt = cnt+1;
		num = Math.floor(num/10);
	}
	return cnt;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter