Re:Using Dispatch Tables to Avoid Conditionals in JavaScript
by chime on Monday May 13, 2013 @12:15PM
(#5699525)
Actually my code ends up looking pretty much like yours. I use CoffeeScript and was writing a simplified JS equivalent off the top of my head since this post was about JS. Similar to your Renderer, I have a DrawForm class that iterates through DrawField class objects which provide the checkbox(), radio() etc. methods.
My point was that in the end, you get to do dynamic function instantiation, which is pretty awesome in JS.
My point was that in the end, you get to do dynamic function instantiation, which is pretty awesome in JS.