Re:Using Dispatch Tables to Avoid Conditionals in JavaScript
by xhrpost on Monday May 13, 2013 @12:06PM
(#5699461)
It's just a way of getting rid of the redundant "function()" syntax. Unfortunately with bind(), we have to set the scope even though it isn't always necessary. So in this case, the first parameter "this" is also probably redundant. The old PrototypeJS curry() would have been the least redundant solution:
movePlayer.curry("north")
[ Parent
| on HN ]
Re:Using Dispatch Tables to Avoid Conditionals in JavaScript
by k3n on Monday May 13, 2013 @12:52PM
(#5699770)
There's also partial():