4 ms·
things.every(thing => thing.type == 'hat' && thing.color == 'green') now negating this gives: things.some(things => thing.type != 'hat' || thing.color != 'g
by 11235813213455 2y ago
things.every(thing => thing.type == 'hat' && thing.color == 'green')
now negating this gives:
things.some(things => thing.type != 'hat' || thing.color != 'green')
So liar has something that is not a hat OR has something that is not green
So only "E) The liar has no green hats" is true
- brianush1 2y agoYour initial translation into JavaScript is a representation of the statement "All my things are green hats", which is not the same as "All my hats are green." The statement "All my hats are green" would map to things.every(thing => thing.type != 'hat' || thing.color == 'green') i.e., everything the person owns must either be green or, if it isn't green, it must not be a hat since all hats are green. The negated form would then be things.some(thing => thing.type == 'hat' && thing.color != 'green') i.e., there are some hats that are not green.