nope. the second one won’t work correctly. for exactly the reason the warning was mentioning.
PHP Code:
var x = 1;
alert(!x % 2); // 0
bear in mind that Lint does look for certain string patterns, it does not run or analyse the JS code.
PS. Lint said something entirely different:
Quote:
|
If you only care that a value is truthy or falsy, then use the short form.
|
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.