How to use object3d.visible method so it will make objects visible in correct order?

I implement an animation of STL models just by looping and changing the visibility of each object. At first I thought the problem is with setInterval, but after I checked an iteration counter of the loop, and it’s in correct sequence. Then I read some articles, it seems that .visible has some delay to apply. How can I solve it? Or is there another completely different solution to animate STL models?
see the video
see my code
At each code running I get random sequence

The order of models in the array meshPairs might be wrong, if you push the models in the order they are loaded. This may happen because loading is asynchronous and this also causes a randomness.