A Product Manager Learns to Code: Week 5

This week I got deeper into JavaScript with loops. I'm moving much more slowly now, as these concepts are a little more foundational and harder to grasp.


Accomplishments for Week 5: 

  • Truthys and Falsy. Don’t ask me to explain it because I’m not quite sure I understand it. 
  • Ternary Operators. This was great. It’s basically a short cut for writing long if else statements. 
  • Loops! Oh, dear loops. These are a really important concept, and they can be confusing at first, but I'm definitely getting the hang of it now. Except nested loops. 
  • Switch Statements! These are amazing. I understand whey they didn't teach them first, but I wish they would have taught me these first.
Ternary operators, explained in two lines.

Ternary operators, explained in two lines.


  • A loop has three essential parts: When to start, when to stop, and how to get to the next item.
  • DO NOT run an infinite loop in your browser console just to see what happens. It is very annoying and will crash your browser. You may panic trying to get it to stop.
  • Oh. My. God. I spent 4 days trying to figure out what was wrong with some code for a quiz… only to find a typo literally four days in. Udacity is super picky with its automated code-check, so if you have a typo your code won’t pass. In this case I has a misspelled word (Not a syntax error). Dear God, help me.
A simple loop with the essential three pieces.

A simple loop with the essential three pieces.

Ah Ha Moment: 

  1. Switch Statements: Replace this super lengthy else if statements with switches. You can switch which piece of code is run based on the variable option. ta-da! Magic. You can also take advantage of ‘falling through’ behavior.