Implementing the Underscore.js library as an exercise in JS