Loading ...
Sorry, an error occurred while loading the content.

Re: Problems with default and switch

Expand Messages
  • Douglas Crockford
    ... If you delete the empty case, your program will get smaller and faster.
    Message 1 of 3 , Jan 11, 2011
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, Luke Page <luke.a.page@...> wrote:
      >
      > Hello,
      >
      > I'm getting
      >
      > *Error:*
      >
      > Problem at line 4 character 3: Empty case
      >
      > default:
      >
      > with switch cases with the following code... (this is a hugely simplified
      > example)
      >
      > var func = function (a) {
      > switch (a) {
      > case this.c:
      > default:
      > throw new Error("Not supported");
      > }
      > };

      > Is this an error?


      If you delete the empty case, your program will get smaller and faster.
    Your message has been successfully submitted and would be delivered to recipients shortly.