We could even trigger the (set)intervals before all the data has been retrieved:
Code:
complete = (++counter == 5);
..but we would need to ensure data is available (has been returned) before attempting to insert it in the DOM.
However, my code as written will just stop inserting if it runs out of retrieved values.