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

3115Re: [jslint] Re: Switch Case Style

Expand Messages
  • Felix E. Klee
    Feb 2, 2013
      On Sat, Feb 2, 2013 at 4:33 PM, paperlampshade <beefo@...>
      wrote:
      > ~~~~switch (input) { case 1:
      >
      > [...]
      >
      > Why is it important to have switch case syntax as in the second example?

      Looks strange. The following formatting is IMHO easy to read and it
      is accepted by JSLint:

      var test = function (input) {
      'use strict';
      var output;
      switch (input) {
      case 1:
      output = "a";
      break;
      case 2:
      output = "b";
      break;
      case 3:
      output = "c";
      break;
      default:
      output = "";
      }
      return output;
      };

      BTW, just post emails in plain-text and no need to insert these ugly
      `~`.
    • Show all 6 messages in this topic