Simple nested loop doesn't work?

Hi! I have a question about JavaScript and Threejs. I made an object title_and_coord that stores sentences and their Vector3 coordinates (for wherever each sentence appears in my scene). I am trying to access this outside of my init() function in iterateObject(). But on debugging, I saw that the 828 line for (let key in title_and_coord) { doesn’t run and skips to line 838 word_and_coord[word] = shared_coords; If I run console.log(title_and_coord); globally, I indeed get an object in my console with the titles and their respective Vector3 values. Where am I going wrong? This is my first time with three.js so I apologise for the messy code! Thank you :slight_smile:





your snippets are missing when iterateObjects is being called.

but either way, in my opinion using callbacks is never ideal and your problem is most likely related to that. javascript async/await is an easy way way to write async code with confidence.

1 Like