Free Code Camp 2016: 20 Hours! 301 Waypoints

Hi Coders,

It’s a new year and Free Code Camp has graciously offered up some exciting new content. Since my last login ( several months ago ) several new javascript challenges popped up.

While trying to power through, I came across minor stability and indexing issues ( 2/17 ) .

Oops!

This minor irritation occurs every time I complete a challenge and the following challenge is New! It could be related something of not being able to populate my old answers or what not.

Anywho, great stuff, it took me a couple of hours to slog through the new javascript basic waypoints ( update the estimated time! ).

One thing that was tripping me up was the array.join() method.

W3schools api link

MDN Link

I never seem to remember to how use this built-in method. I’d like to believe that its my python background thats getting me confused.

" ".join([]);  // is this right? NOT IN JAVASCRIPT

Thinking through this example slowly, the code above is a string operation being applied to an array. What we want:

str = arr.join('separator');  // javascript happy!

This is an array operation that takes a string as an argument and produces a string. I don’t have a good way to remember this, thank heavens for google and stackoverflow.

Some other tricky waypoints that had me scratching my head were: Record Collection and Profile Lookup under Basic Javascript. These challenges actually involved writing a small function and putting together some of the basics learned from the previous challenges.

Record Collection

This challenge tests your knowledge on traversing JSON and javascript dictionaries. Combined with some simple logic operators and if /elses you are to produce a function that:

  • update the collection
  • update elements of the array in the collection
  • delete properties

What took me so long was that I wasn’t using all the parameters upfront. You are given (id, prop, value) and I was ignoring id. FAIL! After realizing that, the rest was simple. Some notation takeaways:

  • use dot notation whenever possible for javascript valid variables when the name of the property is known in advance.
  • use bracket notation for variable properties and properties containing characters or spaces.

Profile Lookup

This challenge continues with accessing javascript dictionaries, but not iteration is required. The solution is simple enough. However I was thrown off because my code with returning too early and thus breaking the loop.

WARNING: if you return in a function, the function exits and the code beneath is rendered void.

So to fix the issue, I simply moved the return statement to be the last line of the function definition. Hope that helps.

Next Up

I’ll working on reclaiming my basic certification. This requires completing a new Tribute Page project as well a the Caesars Cipher algorithm. Until next time campers!