realm
A separate JavaScript global environment with its own built-in objects, such as the one inside an iframe or a worker.
In more detail
An Error created in another realm uses that realm's Error class, so instanceof Error is false in yours. Checking a property or using Array.isArray is more reliable across realms. An iframe is a web page embedded inside another page.
Related terms
- instanceof — The JavaScript operator that checks whether an object was created by a given class, by walking its prototype chain.
- prototype chain — The linked list of objects JavaScript searches when looking up a property, which is how inheritance works under the hood.
Taught in
- The in Operator And Instanceof Narrowing — Production TypeScript