typeof x returns a type string for primitives ("string", "number", "function") — but "object" for arrays, null, and most objects. To tell objects apart, use x instanceof Array (walks the prototype chain) or purpose-built checks like Array.isArray(x). Use the right tool for the right question.