This code is, for the most part, taken from code written in the excellent book Functional Programming in JavaScript by Luis Atencio. The only difference is that I've used prototypes instead of classes and written tests.
These were a fun exercise. It's one thing to read and understand, but by actually coding it up and testing I was able to get a better grasp of the concepts.