Currying in JavaScript