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

Re: Wrapping assignment in extra parentheses no longer working.

Expand Messages
  • Chris
    ... JSLint does not complain about the following code, which features assignment inside a conditional: /*global document */ var p; if ((p =
    Message 1 of 6 , Feb 25, 2011
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "Douglas Crockford" <douglas@...> wrote:
      >
      >
      > I found that there were cases where people would take the erroneous code and wrap parens around it to avoid the warning.
      >
      > The assumptions behind JSLint call for subsetting the language so that the correct constructs are more easily distinguished from errors.
      >

      JSLint does not complain about the following code, which features assignment inside a conditional:

      /*global document */

      var p;

      if ((p = document.body.lastChild).nodeName.toLowerCase() !== 'p') {
      p = document.body.appendChild(document.createElement('p'));
      }


      Should JSLint issue a warning for this?

      Thanks!
      - Chris
    Your message has been successfully submitted and would be delivered to recipients shortly.