Mathias Bynens (2014-02-21T07:03:32.000Z)
On 20 Feb 2014, at 21:20, Eric Elliott <eric at ericleads.com> 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.
domenic at domenicdenicola.com (2014-02-24T21:29:07.495Z)
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.