You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
can be negated by grouping them and applying the ! operator, i.e.
!(ainobj);!(ainstanceofC);
Applying the ! operator incorrectly (on the LHS operand) leads to bugs:
!ainobj;// will evaluate to false, unless obj has a "true" or "false" key!ainstanceofC;// will evaluate to false, unless C overrides instanceof with a @@hasInstance method
This is an example, which we don't hold to the same standard as the rest of the codebase. And that line of code is only guarding against some rogue requests, which the example will never trigger. No harm in making it better, of course!
Description
in
andinstanceof
expressions in JScan be negated by grouping them and applying the
!
operator, i.e.Applying the
!
operator incorrectly (on the LHS operand) leads to bugs:For more information, please see these MDN docs and the no-unsafe-negation recommended Eslint rule.
I have found several potentially problematic instances of the above bugs in your codebase:
https://github.com/SergioBenitez/Rocket/blob/26a3f00f82b6ddec2bbdb3ecb0c29d6ff0da7472/examples/chat/static/script.js#L97
The text was updated successfully, but these errors were encountered: