Reflection — An Honest Take 8 min

Honest Take — Before You Begin

Here is the honest truth: JavaScript will offend your Ruby sensibilities. Ruby was designed to make programmers happy. JavaScript was designed in ten days to make Netscape ship. You will encounter this behaving nothing like self, equality operators that lie (== vs ===), and a type coercion system that treats [] + [] as an empty string. This is not a bug. This is the language.

The culture shock runs deep. Ruby has one way to define a class. JavaScript has constructor functions, prototypal inheritance, Object.create, ES6 classes (which are syntactic sugar over prototypes), and factory functions. Each has advocates. None is canonical. If Ruby is a Japanese garden, JavaScript is a bazaar -- loud, messy, full of treasures if you know where to look.

Now, the good news. Closures are just blocks and procs with a different name. map, filter, reduce are map, select, inject. Higher-order functions are everywhere, and you already think in them. The functional patterns that feel advanced in Ruby are the default in JavaScript. You are not starting from zero.

The curriculum gives you two philosophical paths: Douglas Crockford's "Good Parts" approach (avoid the bad parts, pretend they don't exist) and Kyle Simpson's YDKJS approach (understand everything, including the ugly corners). I lean toward Simpson. Avoiding the bad parts works until you inherit a codebase written by someone who didn't avoid them. Understanding everything means nothing surprises you. That said, Crockford's instinct to constrain JavaScript is exactly why we have linters, TypeScript, and "use strict". Both perspectives are right.

Do not rush through this module to get to React. Every React bug you will ever debug traces back to a JavaScript fundamental you did not fully understand. Closures, the event loop, this binding, reference vs value -- this is the foundation everything else stands on.

Learning resources 7

That's the free preview. Sign in to continue this course.

Sign in to continue

New here? Make a desk →