Functional programming in Javascript: The basics