How to write if condition: if (a !== b) and just the first case when (a === b) Javascript [closed]

I have a problem I don’t know how to write if condition for all cases when a !== b and just the first case when a === b

I tried

let valuesAreTheSame = false;

if (a !== b || (a === b && valuesAreTheSame )) {
 // some code
} else {
  valuesAreTheSame = true;
}

But it doesn’t work.

Please, help)))