Logarithmic growth counter
Your solution is a bit wasteful by generating and testing all integers in the desired range while you actually only need a handful of them. 

A big improvement in terms of performance is to avoid modulo arithmetic and increase the step-size tenfold whenever you finished iterating a sub-range 1-9, 10-99, 100-999 and so on:



let max = 7322;
let step = 1;
let next = 10;

while (step &lt; 1000 &amp;&amp; next &lt; max) {
  for (let i = step; i &lt; next; i += step) {
    console.log(i);
  }
  step = next;
  next *= 10;
}

for (let i = step; i &lt; max; i += step) {
  console.log(i);
}




Of course, you might want to encapsulate above code in a function or even more versatile, a generator function and replace console.log(i); with yield i;.

However, since you only have four different step-sizes of 1, 10, 100, and 1000 you can encode them manually and come up with an even simpler generator function as follows:



// Generate logarithmic range from 1 to max (excluded):
function* logRange(max) {
  for (let i = 1; i &lt; max &amp;&amp; i &lt; 10; i += 1) yield i;
  for (let i = 10; i &lt; max &amp;&amp; i &lt; 100; i += 10) yield i;
  for (let i = 100; i &lt; max &amp;&amp; i &lt; 1000; i += 100) yield i;
  for (let i = 1000; i &lt; max; i += 1000) yield i;
}

// Example:
for (let i of logRange(7322)) console.log(i);




This avoids modulo arithmetic, computes only the desired numbers and is pretty easy to understand.