The last few weeks have seen me carrying on my daily coding challenge.
In week 7, I finished off Free Code Camp’s Intermediate Front End Development Projects, with the last project being another API-based one; pulling in information from Twitch to load a list of online streamers. Again, getting my JSON function to work was a nightmare, and again, I had to resort to using someone else’s code for the basis of my script. However, unlike with my Wiki search engine, the initial coding I’d written wasn’t too far off what needed to be done. I wanted to loop through an array, and push a person’s name, then their online/offline information, into another array. But no matter what I did, I just couldn’t get the two things to happen simultaneously, and correctly. I’d either get a list of people’s names, followed by their info, or I’d get the people listed next to their info, but their names would be listed as ‘undefined’. In the end, it turned out that all I needed in my for-loop was the word ‘let’ at the beginning, which let the function retain the memory of its position in the array long enough for it to extract the info I needed. Jobs a good’un!
For the rest of week 7, and heading into week 8, I made headway on Free Code Camp’s Intermediate Algorithm Scripting problems. I took a rather haphazard approach to completing the tasks, as I couldn’t work all of them out straight off the bat, so I picked and completed the easier ones, with plans to come back to the more convoluted ones later. One I had no choice but to use someone else’s code, namely the one calculating the lowest common multiplier between numbers, not because the coding confused me, but the actual maths did. I’d made a promising start, and had made a program that calculated the lowest common multiplier between two numbers that worked fine, only to find the question wanted the lowest common multiplier between a range of numbers. I just couldn’t figure out the maths for that, let alone write code for it, so I had to take the easy way out.
With that done, I’ve headed back to Free Code Camp, and will spend the rest of my 100 days going over the new sections, trying to get the JS terminal to work (hopefully by then they may have reintegrated the return function again), and perhaps moving onto the ‘advanced’ sections if I have time.