Eric Elliott
Aug 26, 2017 · 1 min read

“in the case of checking whether or not something is an instance of a class or one of it’s subclasses”

Try that check across execution contexts (such as iframes for 3rd party JS), and it will fail.

The problem is, `instanceof` is not a true instance type check. Instead, it’s a prototype identity check. As such, the use case you mention is exactly the type of check you can’t trust to `instanceof`. It works fine until it doesn’t and it’s too late to fix.

)
Eric Elliott

Written by

Make some magic. #JavaScript