currying in javascript