But if you consider “liar” to be an object,
> liar.hats.every((hat) => hat.color === "green")
will throw a TypeError: Cannot read properties of undefined. That’s definitely not `true`.
You implemented the problem wrong, and thus got an error. If hats is a list of colors, then every hat != green is true if the list is empty.
Hm. No.
const liar = { hats: [] };
liar.hats.every(hat => hat.color === "green")
true
This depends on `liar.hats` being undefined, but what if `liar.hats` is an empty array? That seems like an equally valid way of representing a person that owns no hats.