My solutions to the example problem in Eloquent JavaScript