Array.isArraybeginnertypeof [] // β 'object' (misleading)
Array.isArray([]) // β true (accurate)Prefer Array.isArray() over typeof for array detection β typeof returns 'object' for arrays.
typeof [] returns 'object' β the same as for plain objects, null, and other non-primitives. Array.isArray() was introduced specifically to distinguish real arrays from objects.
Challenge: Implement isRealArray that returns true only for real arrays (not other objects) by using Array.isArray.
isRealArray([]) // β true (typeof [] === 'object' too!)
isRealArray({}) // β false
isRealArray(null) // β false (typeof null === 'object' β gotcha!)