nope. the second one won’t work correctly. for exactly the reason the warning was mentioning.
bear in mind that Lint does look for certain string patterns, it does not run or analyse the JS code.
var x = 1;
alert(!x % 2); // 0
PS. Lint said something entirely different:
pay attention to the first part of the sentence. This advice is exclusively about expressions that do not require type-safety! And the author assumed that you can differentiate between an expression and a variable.
If you only care that a value is truthy
, then use the short form.