DEV Community

Discussion on: You don't need null

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️
typeof null
// 'object'
Object.keys(null)
// Uncaught TypeError: Cannot convert undefined or null to object
Enter fullscreen mode Exit fullscreen mode

While this is by design and therefore not a bug, I think this combination of behaviours is what makes for a very bad design. If null is an object, then it should behave like one.

Some comments have been hidden by the post's author - find out more