Re: indexOf in an If clause
- --- In firstname.lastname@example.org, "Jordan" <ljharb@...> wrote:
> `if (!a.indexOf('c'))` and `if (!!a.indexOf('c'))` both do not trigger the "weird condition" error.Yes, I think they should.
> Is it worth also checking that Array.length is always used in an integer context and not a boolean one?No, I don't think so. The confusion with indexOf is that the not-found value is truthy, and only one of the found values is falsy. length does not have that confusion.