Beginner question... what is the best practice to wait for a loop to complete and then do something?
Example code below. Currently returns undefined. I\'m aware of as