Numbers that are not printed in the log also take up time. Why and how to solve it?
<script>
function resort(){
for (let i = 0; i < 10; i++) {
for (let j = 0; j < 10 - i; j++) {
setTimeout(function(){
console.log(i*10 + j);
},(i*10+j)*500);
};
};
}
resort();
</script>
What do you want to express?
It is also the same as the closure in the for loop, wrapping a layer on the outside to execute the function immediately
I don’t know if this is what it means