-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
Describe the bug
in and instanceof expressions in JS
a in obj;
a instanceof C;can be negated by grouping them and applying the ! operator, i.e.
!(a in obj);
!(a instanceof C);Applying the ! operator incorrectly (on the LHS operand) leads to bugs:
!a in obj; // will evaluate to false, unless obj has a "true" or "false" key
!a instanceof C; // will evaluate to false, unless C overrides instanceof with a @@hasInstance methodFor more information, please see these MDN docs and the no-unsafe-negation recommended Eslint rule.
I have found a potentially problematic instance of the above bugs in your codebase:
AR.js/three.js/examples/vendor/webvr-polyfill.js
Line 6245 in 024318c
| if (!'VRFrameData' in window) { |
Metadata
Metadata
Assignees
Labels
No labels