Jim Nielsen’s Blog
Preferences
Theme: This feature requires JavaScript as well as the default site fidelity (see below).
Fidelity:

Controls the level of style and functionality of the site, a lower fidelity meaning less bandwidth, battery, and CPU usage. Learn more.

Notes on “Functional Lite Javascript” by Kyle Simpson

I recently watched the course “Functional Lite Javascript” by Kyle Simpson (author of the excellent “You don’t know JS” book series). If you have a paid subscription (which I dont’t but my employer does) you can watch the video series on Safari Books Online. If you don’t have the dough for an O’Reilly subscription, Kyle also made a book available on Github that, at least to my cursory glance, seems to cover the same subjects from the video series.

In the video series, Kyle teaches fundamental functional concepts in an applicative method. He doesn’t teach “functional programming” from an academic / theoretical perspective, which means you don’t hear a lot of esoteric words like “currying”, “memoization”, and “monads” (though he does introduce them). The general structure of the course covers these fundamental list operations in Javascript:

The following points piqued my interest so I wrote them down.

Decrease side effects

Composition

Immutability

const

const x = 3;
const x = 7; // reference error

const y = [1,2,3];
const y = [4,5,6]; // reference error

// Not so functional
const a = ['foo'];
z.push('bar'); // ['foo','bar']
z[2] = 'baz'; // ['foo','bar','baz']

// Functional
const b = ['foo'];
c = b.concat('foo', 'bar'); // ['foo','bar','baz']

let

Recursion

Composition (via .reduce())