100 Days of Code, Day 11:
24 June 2017
Today’s Progress:
It is now the 25th but I was so into the work and actually eating and showering that I didn’t get the article out in time. I was so spent after going at it hard for a couple weeks now. I needed coffee, and I am trying to stay away from it. Ha.
So at 1:19 am I am writing about my progress from yesterday which I was all excited about.
We are on arrays at The Web Developer Bootcamp. We had a problem set, as Colt is wont to do after or close to the end of each section.
Four algorithms. Reversing the items in an array using a loop. We learned about forEach
which I really like and we could use that if we wanted to or a regular for
loop.
The second algorithm was to see if all the items in an array were uniform or the same.
The third is to sum an array. I didn’t get to that one yet as I started quite late.
And the fourth: max()
which is a function that takes and array as an argument and determines which is the highest number in the array.
I did the first two. He mentioned that we’d need a loop for most of them but I found I didn’t need a loop for the first algorithm. All I needed was to pass a parameter arr
into the function printReverse()
and then add the reverse()
method on the array.
The second one was a bit trickier because I was trying to be cute and use a forEach
loop. I wasn’t successful - not all my test cases were passing. I even tried every()
to no avail. So then I went back to Stack Overflow and found that, indeed, I would need a for
loop. At least until I could refactor to figure out how to use a forEach
loop for this algorithm.
Simple algorithms but just a few months ago, I probably wouldn’t have figured them out without hand holding. Understanding parameters, functions, arguments, and that you can pass functions and objects into other functions has opened up my brain to all kinds of possibilities.
Thoughts:
I am getting so much better at this and finally after two years of doing it.
Link to work:
Repo.
Gist: