Neat, though it breaks backward compatibility -- each regexp is
converted to string before the comparison, IIRC.  (Compatibility may
not be a big problem in practice in this case.)

--lars

On 10/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> allow RegEx in case
>
> var str= 'a';
> switch( str ) {
>   case /a/:
>     alert('a');
>     break;
>
>   case /b/:
>     alert('b');
>     break;
>   }
>
> _______________________________________________
> Es4-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es4-discuss
>
>
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to