The negation operator in JS

Why in this case

if (! x === y) {
console.log ('true');
} else {
console.log ('false');

gets false since the negation operator is used. Without the negation operator it also gets false because the operator ‘===’ checks if it compares the same values with the same data type. Why, then, after putting the exclamation point directly after x, does he still get false, since it contradicts falsehood, so I should get the truth?

36 thoughts on “The negation operator in JS”

Leave a Comment