1165Re: [jslint] Unclear expression evaluation of ? :
- Feb 18, 2010On Wed, Feb 17, 2010 at 12:22 AM, Woomla <woomla@...> wrote:
>[Non-text portions of this message have been removed]
> In the code snippet below, b will always be 'is TRUE'. Clearly 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')
- << Previous post in topic