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

2903Re: [jslint] skipping for loop parameters

Expand Messages
  • Mike
    Jun 26, 2012
    • 0 Attachment
      This to me is clearly a situation of code being too clever for its own good. Simply write it out the statement in full. What's so hard about that?

      Joe Martin <joe.martin@...> wrote:

      >Iterating over an array backwards like:
      >/*jslint plusplus: true */
      >var ii, foo = [];
      >for (ii = foo.length; --ii;) {
      > foo.push("hello");
      >produces the error "Expected an identifier and instead saw ')'." for
      >the for line. Is there a reason that for parameters can't be skipped?
      >The similar infinite loop case 'for (;;) {' works fine though.

      [Non-text portions of this message have been removed]
    • Show all 4 messages in this topic