January 2020
Intermediate to advanced
470 pages
11h 13m
English
Let's pause for a minute and consider what we need from this wrapper. There are two basic requirements:
To get started, let's create a basic container. Any object containing just a value would do, but we want some additions, so our object won't be that trivial; we'll explain the differences after the code:
const VALUE = Symbol("Value");class Container { constructor(x) { this[VALUE] = x; } map(fn) { return fn(this[VALUE]); }}
Some basic considerations that we need to keep in mind are as follows:
Read now
Unlock full access