I Hope This Makes My Mom Proud

Over the course of a couple days, I solved my second Free Code Camp Basic Algorithm Scripting assignment! Once again, I needed the tiniest bit of help–which I wouldn’t mind if it weren’t so frustrating. My code worked on my local machine and even in the FCC app, technically meeting the assignments requirements/rubric but … someone in the FCC Help Gitter room said, “Move that line from here to there” and even though it didn’t really change anything, FCC’s little robot then accepted it.

Many, many sheets of paper sacrificed their lives and lay in a crumpled heap in my trash can so I can show you my work for “Factorialize a Number.” I have a whiteboard at work and I would kill for one at home. While my wife and I were separated a couple years ago, I painted the walls of the room I was renting with this whiteboard paint and it was awesome but she wouldn’t put up with that in our house and I think I’d rather have her than a giant whiteboard anyway. Anyway …

BTW: Of all my favorite music for listening to while I code, I think Top 40 Ultimate Arabic Classic Bar Grooves is my mostest favoritist. Forty awesome songs for like $9.99 in the iTunes machine.

Back in the glory days, I learned to build and troubleshoot code by doing things step by step and using a lot of messages to the console so my code for today went from this:


to this …


Now, onto finding palindromes!

Oh, also BTW, Batman vs Superman isn’t as horrible as people are saying. My expectations were low, so I enjoyed it and my son said it was “A-maz-ing!”

Update: Found a great resource for these algorithm exercises. Seeing the questions and problems even just in somebody else’s words is so helpful. This other blogger did pretty much what I had in mind initially but abandoned because of the way the problem and placeholder code were written (see my frustrations with this in other posts including the next one).

function factorialize (num) {
var total = 1;
for (var i = 1; i <= num; i++) {
total *= i;
return total;

This other student/blogger uses a lot of “shortcuts” (I’m sure that’s not the most accurate description/name) I’m unfamiliar with in their solutions, but the algorithm above is basically what I had in mind.

I also (as I’ve ranted about before) have to deal with browser issues, etc. when I’m trying to work in FCC.  I can never really trust the results whether they work or not, depending on where I’m working/testing.


About jotascript

Aiming to please. Seeking to impress.
This entry was posted in myProgress and tagged . Bookmark the permalink.

4 Responses to I Hope This Makes My Mom Proud

  1. Chris says:

    One of the things I like about coding is seeing the different approaches people take to the same problem. I find your solution interesting, which line did they suggest moving? I also wrote about this challenge as well. http://wp.me/p4LxIy-19


    • jotascript says:

      I knew in my gut the solution was as simple as yours but it just wasn’t clear to me why and that is always an obstacle to me. I should just trust my instincts in coding and all things but, in all things, I overthink it.

      Liked by 1 person

    • jotascript says:

      They suggested I move what is now line 2 from outside the function to its current location at line 2.


      • Chris says:

        Ahh that makes sense. Based on your the text in your post “it didn’t really change anything” I’m guessing they didn’t explain why the change made a difference.

        Take a look at this:
        Moving it to line 2 made it a local variable while being outside the function it was a global variable. I’m betting that FCC’s little robot was ok with the first test case but every test case after that had a problem.

        With it being a Global variable it was never “erased” or reset back to nothing. So every time the function was called it still had the previous results in it.

        If you have any questions about my “shortcuts” just let me know. I’ve been on and off again doing javascript for a little while and forgot about explaining some things properly.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s