Treehouse Learning: Day 3
Day 3:
Momentum has slowed today due to being out of the house and not being home until well past 5pm or 6pm. I didn't get started on my daily learning until about 8pm. By this time having been up since early (for me!) this morning, I didn't get a full day of work in. I did do some and found myself struggling a little. Functions day, what can you do.
I have found that I am loosening my brain grip on being too literal with the challenges/tasks. I'm still seemingly struggling with grasping some of the concepts unfortunately. I may end up purchasing another notebook to keep all my notes in (and rewriting them so it's all in one place.) I really am looking forward to doing my daily learn on within my office when my organizer/monitor stand arrives in the mail. A desk is better than an old XboxONE box.
As I closed out the day, I decided to revisit the codewars website to see if I could solve the question (after a half day of functions).
The question was this: Fix this code so it passes.
function multiply(a, b) { a * b; }
My first guess wasn't correct. Using var wasn't the correct way to make this work. So what else in my arsenal could I try. Ok, so I may have cheated a little, using JSHint to give me clues as to why it wasn't passing. Instead of using var, I tried using return to pass the argument. I came up with this:
function multiply(a, b){ return a * b; } multiply();
By using return, I'm able to pass the argument to the function. After which I call the function. Putting this into codewars, it passed and I was granted access (aka I made it past the initiation.) As tired as I am today, I found that to be quite an accomplishment.
Holy heck. I can't believe I understand what I'm doing. This is amazing.