Is there a good way to do a for loop with a for each loop in javascript?
I want to make a for loop in one line.
Is there a good way to do a for loop with a for each loop in javascript?
I want to make a for loop in one line.
Or ....
Array(9).fill(0).forEach((_,i) => console.log(i));
Try this:
(new Array(int + 1).join("0").split("")).forEach((e, i) => {console.log(i);})
int means iterate times