Add geometry in for loop and render it imedietly

I have a loop , for or while dosent matter and i want to add a certain geometry every iteration in the loop and want to render it imedielty after adding it. For example something like this

for(let i =0;i<10;i++){

//make some cube here
//add the cube
scene.add(cube);

//render the scnene here with the added cube
}

What i want to achive is something like animiation where i see the cubes added one by one . I dont want to add all of them at once and render the 10 cubes at once. Is there a way to force render in the for loop i have to look at something else .

look at the interactive cubes example
three.js examples (threejs.org)
image
you can see the source code by pressing the <> bottom right of screen

You’ll need to use some sort of setTimeout function to have a noticeable delay in adding objects one by one, if you’re using a render loop the scene will render and update automatically when adding objects

The thing is that i want to add them , not change their color or attributes , im doing a pathfinding vizualizer , and i want to achive animation of algorithm working in progress.

if you know the path already, then you can add your cubes to the scene, but with the visible property set to false.
Then individually change the visible property to true of the cube you want to show, whenever you want.
If you have a continuous animation loop running, like most official examples do, see link I added in previous post for one example, then the visibility change will be shown on the html canvas about 1/60th of a second later. You can hide your cubes again later if you want.

halt render when u add object to the scene to avoid browser memory allocation error, u can manage this by adding loading manager, instead of for loop use function to be called by the loading manager every time a model has been loaded,

the crash may not occure when loading shapes and basic geometries, but when u load gltf and fbx model the crash becomes evident