Hint
typeof null = "object" is a historic bug. Use Array.isArray() for arrays.
console.log(typeof null);
console.log(typeof undefined);
console.log(typeof []);
console.log(typeof function(){});object undefined object function
Explanation: typeof null = "object" is a famous JS bug. typeof [] = "object" (arrays are objects). Functions have their own typeof result.
Key Insight: typeof null = "object" is a historic bug. Use Array.isArray() for arrays.