JSFiddle - React, Tailwind, and code Playground

by Pritesh Patel

JavaScript

function countZero(n){
  var count = 0;
  while(n>0){
   count += Math.floor(n/10);
   n = n/10;
   //console.log(count);
  }
  return console.log(count);
}

countZero(2000)