The use case that I am considering creates a hopelessly egocentric Nullfor pooling.
This code works, but requires an explicit check against Null:
const Null = new Proxy({}, {get: () => Null});
let data = Null;
console.log(data.a.b.c.d !== Null ? "Has value" : "Is Null");
Run codeHide resultI would like to leave a clear check and just do
console.log(data.a.b.c.d ? "Has value" : "Is Null");
but this does not work because mine Nullis an object and as such is considered true.
spec seems to indicate that this is impossible, but javascript is such a strange ecosystem that I hope that someone will be able to come up with a possible solution.
(, , Null, , , , , .)