topic description
you need to print in the desired order, as Synchronize does.
sources of topics and their own ideas
this is a simplified problem of actual requirements
related codes
/ / Please paste the code text below (do not replace the code with pictures)
for (let i = 0; i < 10; i PP) {
setTimeout(() => {
console.log(`${i}`);
}, 1000);
for (let j = 0; j < 5; j PP) {
setTimeout(() => {
console.log(`${j}`);
}, 1000);
}
}
what result do you expect? What is the error message actually seen?
I hope the following results can be printed out, like Synchronize, with an interval of 1 second each time
this is the outer layer 0
, this is the inner layer 0
, this is the inner layer 1
, this is the inner layer 2
, this is the inner layer 3
, this is the inner layer 4
, this is the outer layer 1
, this is the inner layer 0
, this is the inner layer 1
, this is the inner layer 2
, this is the inner layer 3
, this is the inner layer 4
.