Currying JavaScript