Skip to content

#instanceof

1 article tagged with instanceof

Note

typeof vs instanceof - two ways to check a type in JS

JavaScript has two core operators for checking what type a value is, and each answers a different question. typeof returns one of 8 strings and has known gotchas (null, arrays). instanceof walks the prototype chain and fails for objects from an embedded <iframe>. A note on when to use which, and why arrays have a dedicated Array.isArray.

May 8, 2026 #javascript #typeof #instanceof