How is the asynchrony under the nesting of js, multi-layer for loops executed sequentially?

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
.


if the interval is only 1 second, then this is fine

   

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e88ca3-4598a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e88ca3-4598a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?