functional programming in JavaScript for beginners