Sign up ×  Here's an implementation details question for
JavaScript gurus.  I have a UI with a number of fields in which
the values of the fields depend in a complicated fashion on the
values of seven bits of inputs. Exactly what should be displayed
for any one of the possible 128 values that is changing
regularly as users see more of the application?  Right now, I've
for this being implemented as a decision tree through an if-
then-else comb, but it's brittle under the requirements changes
and sort of hard to get right.  One implementation approach I've
thought about is to make an array of values from 0x0 to 0x7F and
then store a closure at each location --  var tbl; // initialize
it with the values tbl[0x42] = function (){ doAThing();
doAnotherThing(); }  and then invoke them with   This, at least
makes the decision logic into a bunch of assignments.  Question:
is there a better way?  (Update: holy crap, how'd that line
about 'ajax iphone tags' get in there? No wonder it was a little
puzzling.)   So what hap