MDN URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof
For instance,
[] instanceof window.frames[0].Arraywill returnfalse, becauseArray.prototype !== window.frames[0].Arrayand arrays inherit from the former.
I believe the inequality should be Array.prototype !== window.frames[0].Array.prototype. In addition, 'arrays' alone might suggest that all arrays inherit from Array.prototype, including those from frames[0]. I think that needs to be clarified, e.g. 'arrays created in the current context'.
For example, checking if a Nodes is a SVGElement in a different context, you can use myNode instanceof myNode.ownerDocument.defaultView.SVGElement.
It should be 'Node', not 'Nodes'.
However, objects created with the object literal notation are an exception here: Although the prototype is
undefined,instanceof Objectreturnstrue.
It is not true that the prototype is undefined. It's Object.prototype, which is even stated in the code that follows. Thus, there's nothing exceptional here. I think the paragraph quoted above should be removed and some adjustments should be made to the rest of the section (including its title).
Maybe it might be a good idea to mention shortly the role of Symbol.hasInstance?
MDN Content page report details
en-us/web/javascript/reference/operators/instanceofI can update this 👍
Happy to let you give it a go; thanks a lot for all your enthusiasm, @CreaTorAlexander !
@chrisdavidmills I enjoy contributing to mdn/content 😄
Most helpful comment
Happy to let you give it a go; thanks a lot for all your enthusiasm, @CreaTorAlexander !