August 2016
Intermediate to advanced
635 pages
14h 5m
English
Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function. | ||
| --John Carmack, lead programmer of the Doom video game | ||
Functional programming is all about decomposing a problem into a set of functions. Often, functions are chained together, nested within each other, passed around, and treated as first-class citizens. If you've used frameworks such as jQuery and Node.js, you've probably used some of these techniques, you just didn't realize it!
Let's start with a little JavaScript dilemma.
Say we need to compile a list of values that are assigned to generic objects. The objects could be anything: dates, HTML objects, and so on.
var obj1 = {value: 1}, obj2 = {value: 2}, obj3 ...