'Incrementing numbers starting from 0000
I have a starting number to work from which is 0000 and increment it by one, i have that done, but the result is 1,2,3 instead of 0001,0002,0003 etc. How can I achieve this?
Thank you
Solution 1:[1]
for (let i = 0; i <= 9; i++) {
for (let j = 0; j <= 9; j++) {
for (let k = 0; k <= 9; k++) {
for (let l = 0; l <= 9; l++) {
let yournumber = i.toString() + j.toString() + k.toString() + l.toString();
console.log(yournumber);
}
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vlatko606 |
