Day 8 (week2) Javascript functions
After a short review of JS functions from last night’s homework, we jumped right into running JS code from the command line using node. We went through some basic if, then, else logic examples and then straight into our pair programming challenge for the morning.
The first project involved completing some functions to accomplish a given task, like this:
// 1.
// Complete the following function
// It should return `true` if the first argument is greater
// than the second and `false` if not
// Use the greater than operator `>`function greaterThan (num1, num2) {
if( num1 > num2 ) {
return true;
}
return false;
}console.log(greaterThan(3, 2) === true);
This was easy, but I did enjoy talking with my pair programming parter and helping her understand how to logically think about code. We also wrote some functions to determine the winner of a Rock, Paper, Scissors game. This was nice, because I had already done that yesterday before we received the assignment today. It gave me a chance to re-factor that code and improve it’s legibility.
The daily project was also easy. Just working more with JS functions. I’m really hoping that the next few days take us into more details like closures and callbacks.
I spent the rest of the afternoon completing the homework that introduced for and while loops. I found it interesting to read nearly the exact same ideas that I tried to use when teaching looping structure to my students in years past. Dealing with zero-indexed lists and being able to store any type of object in that list can be tricky for folks to understand. I appreciate the clean explanations that were in the reading.
Two observations that I have made today. First, I’m certainly more interested in writing JS code than doing HTML/CSS. I can do both of these things, but front-end engineering doesn’t interest me as much as back-end engineering. Second, as we move into JS, the thinking required to solve the programming challenges has been kicked up a notch. For some folks in the class, I think this change has caught them off-guard.
I continue to be impressed with the skill and intentionality that our instructors have for helping everyone in the cohort with learning the material.
I’m also getting better at using git. I started to use hub at the command line to create and manage my GitHub repos via my terminal. This is much faster and more efficient, as I can create the repo, add it as a remote, and push the code in a much shorter amount of time.
I want more JS, please. :-)
