Is it possible to define an infix function?
问题 Is it possible to define my own infix function/operator in CoffeeScript (or in pure JavaScript)? e.g. I want to call a foo b or a `foo` b instead of a.foo b or, when foo is global function, foo a, b Is there any way to do this? 回答1: ES6 enables a very Haskell/Lambda calculus way of doing things. Given a multiplication function: const multiply = a => b => (a * b) You can define a doubling function using partial application (you leave out one parameter): const double = multiply (2) And you can