typeof returns primitive type string. instanceof checks prototype chain for objects.
Solution Code
JavaScript
[] instanceof Array; // true
typeof null; // 'object'
Explanation
Use constructor.name for better type checking. typeof null is historical bug.Guided Hints
Custom instanceof check
Symbol.toStringTag