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

1165Re: [jslint] Unclear expression evaluation of ? :

Expand Messages
  • William Chapman
    Feb 18, 2010
    • 0 Attachment
      On Wed, Feb 17, 2010 at 12:22 AM, Woomla <woomla@...> wrote:

      >
      >
      > Hi,
      >
      > In the code snippet below, b will always be 'is TRUE'. Clearly the
      > intention was that b should be 'a is FALSE'. No javascript error but the
      > result is wrong.
      >
      > Maybe jslint could issue a warning in this case, something like: 'use
      > parenthesis to clarify'.
      >
      > var a, b;
      > a = false;
      > b = 'a ' + a ? 'is TRUE' : 'is FALSE';
      >
      > This works for me: b = 'a' + (a ? 'is TRUE' : 'is FALSE')


      >
      >


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