I am trying to confirm for myself whether a null object is false. First, I tried to create a null object using Object.create(null). Then I decided to test this object against null.
I wrote a snippet of code to check for truthiness:
let emptyObject = {};
let nullObject = Object.create(null);
console.log(typeof nullObject);
console.log(Boolean(null));
console.log(Boolean(nullObject));
console.log(Boolean(emptyObject));
But my output is the following:
object
false
true
true
The nullObject
is not empty nor undefined, but why does it not have the same truthy value as null
? Are these not both values of null
with object type, object
?