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

2555[jslint] Re: Formatting question

Expand Messages
  • g2223060
    Aug 4, 2011
      I agree with you, Mark- I have been using that style in my own code. Probably why I haven't seen this error until the developer asked for my help with it :) Maybe we should just have a policy that you don't initialize in the declaration...

      Some experimentation with JSLint shows that this is only enforced when there is ONE variable on the first line. For example, this passes:

      var a, b,
      c, d, e, f, g, h, i;

      But this does not:

      var x,
      y, z;


      --- In jslint_com@yahoogroups.com, Mark Volkmann <r.mark.volkmann@...> wrote:
      > Keep in mind this option:
      > var elementInWebPage, i, j;
      > elementInWebPage = YAHOO.util.Dom.get('someElementID');
      > I like to declare all the local variables at the beginning of each function
      > in alphabetical order and then initialize them on separate lines.
      > The only time I initialized them in the var statement is when they have
      > short values like 1, [], or {}.
      > --
      > R. Mark Volkmann
      > Object Computing, Inc.
      > [Non-text portions of this message have been removed]
    • Show all 16 messages in this topic