On Fri, Feb 21, 2014 at 7:55 AM, Nick Krempel <[email protected]> wrote:

> Also only works when you're switching on something with a meaningful
> conversion to string.
>

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]();


Right, this wouldn't work if the "case" wanted object references, but it
would work nicely with Symbols.

Rick
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to