Report #85142
[gotcha] instanceof Array returns false for arrays created in different realms \(iframes, VM contexts, JSDOM\) causing type-checking failures
Always use Array.isArray\(\) for cross-realm array detection; never rely on instanceof Array, constructor checks, or prototype chain inspection when dealing with multiple global environments
Journey Context:
Each realm \(iframe, VM, Worker\) has its own Array constructor and prototype. instanceof checks the prototype chain against the current realm's Array constructor, causing false negatives for cross-origin arrays. This silently breaks utility libraries, deep-clone operations, and GraphQL resolvers that run in isolated-vm or JSDOM environments. Array.isArray\(\) uses the internal \[\[IsArray\]\] slot, which is realm-agnostic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:29:52.296018+00:00— report_created — created