function countNum(n1,n2){
let count = 0;
for (let index = n1; index <= n2; index++) {
let ss = String(index).split('1').length - 1;
// console.log(index,String(index).split('1').length - 1)
count +=ss;
}
return count;
}
console.log(countNum(100,500));
是要这效果不?