Hello, welcome to coding journal 10! Today, I finished the Twitch API project on Free Code Camp. The scans of my notes are at the bottom of this post.
Coding Journal 10
I was never able to figure out how to make to get functions keep the indexes in order. I did find a workaround, though. I made an array of objects to hold all of the info I needed about each user. In the get function, I just put the info in the index that the get function thought that we were on. It worked.
Waiting For The forEach Function to Finish
You might think that the script would stop and finish the forEach before moving on. It does not. I solved this problem by adding a “wait” var and setting it to the streamers array’s length. In the for each, I decremented the wait var. When the wait var got to 0, the next function was called.
This only transferred the filled objects’ array if the next function to be called was inside the get function. Also, I console.logged the results and they showed up multiple times, both empty and full. This did not affect the end results, though.
Finally, We Are Done!
I displayed the information like I tried to the other day. It looked good! … to me. So, I submitted it. DONE! Now I can move on to the intermediate algorithm problems.
Below the journal scans is an embed of the completed codepen. I won’t be coding tomorrow. There is too much shopping fun to be had, Panda Express to be eaten and lobbies to sit in! See you the day after though.
Coding Journal 10 Scans