They're not the same at all. Deleting the car
property of s
still leaves it as an object - admittedly it is an "empty" object with no properties of its own, but that is a very different value from null
. For one thing, {}
is still an object, and delegates to Object.prototype
, so can access methods like s.toString()
(which is used internally for coercion to a string value) and s.hasOwnProperty(propname)
- null
is just a primitive value which you can't call any methods on at all. For another, {}
becomes true
if coerced to Boolean (eg if you do if (s)
), while null
coerces to false.
So the values actually behave very differently.