Home Developer Blog

JS 30 Day 4

Live Demo

Nothing too pretty here unless you think arrays are pretty... which I could get get on board with! Day 4 was a very informative episode that I will definitely have to watch and play around with a few times in order to fully understand.

The Task:

Today was a series of 8 questions based around Array built in methods.

Thoughts:

Someone I really respect in terms of their knowledge on javascript told me to go to MDN for all your questions on the matter. So thats where I go if I am unsure about how a method works. The methods we used were filter(), map(), sort(), reduce(), and... I might be forgetting one. Regardless, rather than regurgitate the explanations off of MDN I highly suggest it as a great resource for javascript questions. Every answer was printed to the console so all the fun stuff is in there. I added the information that was in the javascript comments into the page itself. The most helpful part of all of this would probably just read the js file though.

I got a refresher with ternary comparisons. Here is an example from MDN. This syntax paired up with an ES6 arrow function makes for some really slick one liners.

            
var elvisLives = Math.PI > 4 ? 'Yep' : 'Nope';
            
        

Maybe I will write more when I can explain these concepts better than the MDN docs. Until that happens this is it.

Here is the source for day 4.