On 20 Feb 2014, at 21:20, Eric Elliott <[email protected]> wrote: > Object literals are already a great alternative to switch in JS: > > var cases = { > val1: function () {}, > val2: function () {} > }; > > cases[val]();
In that case, you’d need a `hasOwnProperty` check to make sure you’re not trying to call `__proto__` or `toString`, etc. See <https://github.com/rwaldron/idiomatic.js/#misc> for a more complete example. _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

