JSFiddle - React, Tailwind, and code Playground

by velmurugansp

JavaScript

function findDigits(x){
	let digits = 0;
  while(x > 0){
  	let reminder = x % 10;
    x = (x - reminder) / 10;
    digits++;
  }
  return (digits);
}

let count = findDigits(187623);

console.log(count);